Scale Distribution Framework
Project description
Scaled
This project is aiming the target that provides simple and efficient and reliable way for distributing computing framework, centralized scheduler and stable protocol when client and worker talking to scheduler
Introduction
The goal for this project should be as simple as possible
- It built on top of zmq
- it has ready python version of Client, Scheduler, Worker
- I will provide golang or Rust version of Scheduler, the goal for the Scheduler should be completely computer language agnostic, which means they follow the same protocol
- Scheduler might support function based computing tree in the future
Installation
pip install scaled
if you want to use uvloop, please do: pip install uvloop
, default we are using python builtin uvloop
How to use it
Start local scheduler and cluster at the same time in the code
import random
from scaled.client import Client
from scaled.cluster.combo import SchedulerClusterCombo
def calculate(sec: int):
return sec * 1
def main():
address = "tcp://127.0.0.1:2345"
cluster = SchedulerClusterCombo(address=address, n_workers=10, event_loop="uvloop")
client = Client(address=address)
tasks = [random.randint(0, 100) for _ in range(100000)]
futures = [client.submit(calculate, i) for i in tasks]
results = [future.result() for future in futures]
assert results == tasks
client.disconnect()
cluster.shutdown()
if __name__ == "__main__":
main()
Start scheduler and cluster independently
use scaled_scheduler
to start scheduler, for example:
scaled_scheduler --allocator-type queued tcp://0.0.0.0:8516
use scaled_cluster
to start workers:
scaled_worker -n 10 tcp://127.0.0.1:8516
Then you can write simply write client code as:
from scaled.client import Client
def foobar(foo: int):
return foo
client = Client(address="tcp://127.0.0.1:2345")
future = client.submit(foobar, 1)
print(future.result())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file scaled-0.9.tar.gz
.
File metadata
- Download URL: scaled-0.9.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5ad7005458dcc49f4f320bc672387f03b91eadb868c1347a75e862df706f0ec |
|
MD5 | e005276b1afd56d5cdfe1a363777d3c7 |
|
BLAKE2b-256 | e65bbdf751547126f8a50ee2fdfab7629f5f4faa482b5ccbd1e8d8cdf030f4cc |
File details
Details for the file scaled-0.9-py3-none-any.whl
.
File metadata
- Download URL: scaled-0.9-py3-none-any.whl
- Upload date:
- Size: 35.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 587756da04a80111811bcdb9bdc65ca6f4598f1adf9a1098c6cab0f23e810c09 |
|
MD5 | e7cb30bc4d51838b68893e84dd58ba09 |
|
BLAKE2b-256 | 694e958d0e276980422047e18d6307a2fb0fc97c07539836a3f570110c5cc2bd |