Skip to main content

Goliath

Authors

Logan Pulley, Zachary Oldham, Ilie Vartic, Deepan Venkatesh, Manikandan Swaminathan

Abstract

This package enables Python to offload sets of function calls to pools of remote worker processes.

Details

When handling large sets of data, the thread-pool model can often do wonders for parallelizing and thus speeding up a program. However, Python's native support for concurrency is more like polling than threading; it doesn't properly take advantage of multiple CPU cores. This can be frustrating when working in Python with a task that would be easily threadable in other languages.

Goliath enables Python to distribute a set of function calls over a set of servers. This essentially simulates the thread-pool model as a pool of servers, each maintaining a pool of Python worker processes. Additionally, these servers can be reached over the Internet, enabling a many-to-many relationship between clients requesting work and servers providing workers; each client can have work distributed across multiple servers, and each server can handle work from multiple clients.

Goliath abstracts this entire model and aggregates the results from the servers, finally returning the list of results to the coder.

Requirements

  • Python 3.7+

Installation

Install with pip:

pip install goliath

Usage

Sending work (Commander)

# foo.py

from goliath.commander import Commander

# The function to execute
def foo(bar, baz):
    return str(bar) + str(baz)

# Function to generate list of arguments to try
def foo_args(bar_range, baz_range):
    for bar in bar_range:
        for baz in baz_range:
            yield { 'bar': bar, 'baz': baz }

if __name__ == '__main__':
    # Create a commander (doesn't connect yet)
    cmdr = Commander([
        # Lieutenants can be hostnames, domains, IPs
        ('lieutenant-hostname', 8080),
        ('lieutenant.com', 3333),
        ('127.0.0.1', 2222)
    ])
    # Connect to lieutenants, run all the functions, and get results
    results = cmdr.run(foo, list(foo_args(range(10), range(10))), ['foo.py'])

Performing work (Lieutenant & Worker)

To run a lieutenant on this machine on port 3333 with 8 worker processes:

python3 -m goliath.lieutenant localhost 3333 8

Licensing

Goliath is open-source software, licensed under GNU's Lesser GPL.

Release files for goliath 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for goliath 0.2.3
File Interpreter ABI Platform
goliath-0.2.3-py3-none-any.whl Python 3 none any Details

Release files / goliath-0.2.3-py3-none-any.whl

Download URL goliath-0.2.3-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7e657145c7024d7c22f5640ad8deea23c435f58d4ffd61156295af7f921892a
BLAKE2b-256 checksum
How to use checksums
e24d8639ef7b71d04d6ec037eb65a2e805f6496fd5fba058442997e8e035e3ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.0

Release history Release notifications | RSS feed

This release

0.2.3 This release

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page