Skip to main content

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 tcp://0.0.0.0:8516

use scaled_cluster to start 10 workers:

scaled_worker -n 10 tcp://127.0.0.1:8516

for detail options of above 2 program, please use argument -h to check out all available options

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scaled-0.32.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

scaled-0.32-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

Details for the file scaled-0.32.tar.gz.

File metadata

  • Download URL: scaled-0.32.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for scaled-0.32.tar.gz
Algorithm Hash digest
SHA256 cfba2b2c2ed97fb2214b0de8d4d5788bee55be0248fa0676740e2f3f0abe68d7
MD5 c45bf895e07cfa280e62625ba2f56484
BLAKE2b-256 c9a547ec2699d300da989ba9001079b620006b78ad3f6ef3f3241bf3cf7a24c2

See more details on using hashes here.

File details

Details for the file scaled-0.32-py3-none-any.whl.

File metadata

  • Download URL: scaled-0.32-py3-none-any.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for scaled-0.32-py3-none-any.whl
Algorithm Hash digest
SHA256 0615e382f9aef990edde73e0f907d5607c4105ce7b471f30ba7b741f2413e140
MD5 0be15717b28173b1423bd47c9de75016
BLAKE2b-256 9d2f57e409230378e7f0a316d78f084f076015c0d138ae9f1b8873fdec76089d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page