Skip to main content

Actor model for Python

Project description

splut

Actor model for Python.

This README is auto-generated, see project wiki for details.

API

splut.actor

ActorHandle Objects

class ActorHandle(Parabject)

__getattr__
def __getattr__(name)

Return a function to add a message to the mailbox, for execution by a capable worker when one becomes free.

__getitem__
def __getitem__(key)

Index or slice workers by the given key and return an actor handle backed by the resulting workers.

__iter__
def __iter__()

For each worker, yield an actor handle backed by that worker specifically.

Spawn Objects

class Spawn()

__init__
def __init__(executor)

Spawned actors will use threads from the given executor.

__call__
def __call__(*objs)

Create an actor backed by the given worker object(s), each of which is used in a single-threaded way. Calling a method on the returned actor returns a Future immediately, which eventually becomes done with the result of a worker method of the same name (or never if the worker method hangs). A worker method may be async, in which case it can await futures returned by other actors, releasing the worker in the meantime.

Join Objects

class Join()

Make multiple futures awaitable as a unit. In the zero futures case this resolves (to an empty list) without suspending execution. Otherwise if any future hangs, so does this. Otherwise if any future failed, all such exceptions are raised as a chain. Otherwise all results are returned as a list.

ManualExecutor Objects

class ManualExecutor()

Utilise the main (or any other) thread directly.

run
def run()

Execute tasks until interrupted. Typical usage is for the main thread to call this after setting up the system.

putinterrupt
def putinterrupt()

Cause exactly one thread to exit the run method soon.

splut.actor.future

Future Objects

class Future()

wait
def wait()

Block until there is an outcome, then return/raise it. For use outside actors, or within one if you know the future is done and don't want to suspend execution with await in that case.

andforget
def andforget(log)

Send any exception to the given log.

splut.bg

Sleeper Objects

class Sleeper()

interrupt
def interrupt()

If a sleep is in progress that sleep returns now, otherwise the next sleep will return immediately. This is similar behaviour to interrupting a maybe-sleeping thread in Java.

splut.bg.delay

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

splut-23.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

splut-23-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file splut-23.tar.gz.

File metadata

  • Download URL: splut-23.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for splut-23.tar.gz
Algorithm Hash digest
SHA256 960a38a857f64d06b42bd7ea435be5ead40d968dcae9d15ee927199d0255ba04
MD5 3d7f82759018d2f911790690443ac219
BLAKE2b-256 37059a50e6c84b4231c6b21f84df41b79e37ad30361b1c9520b6296ff920f7c3

See more details on using hashes here.

File details

Details for the file splut-23-py3-none-any.whl.

File metadata

  • Download URL: splut-23-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for splut-23-py3-none-any.whl
Algorithm Hash digest
SHA256 43461d22874c70abe425568528b427d581ce260d599f4ad3820f071c931f4a91
MD5 916d4bf2d1306ce2d0aa72d4b6e0fc52
BLAKE2b-256 5fe30e9a94aa91096e02e42badf1d1cc81a0b202c09132df90f0aacace054a91

See more details on using hashes here.

Supported by

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