Skip to main content

queue functions for execution later

Project description

I use Later objects for convenient queuing of functions whose execution occurs later in a priority order with capacity constraints.

Why not futures? I already had this, I prefer its naming scheme and interface, and futures did not seem to support prioritising execution.

Use is simple enough: create a Later instance and typically queue functions with the .defer() method:

L = Later(4)      # a Later with a parallelism of 4
...
LF = L.defer(func, *args, **kwargs)
...
x = LF()          # collect result

The .defer method and its sublings return a LateFunction, which is a subclass of cs.asynchron.Asynchron. As such it is a callable, so to collect the result you just call the LateFunction.

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

cs.later-20150115.tar.gz (11.6 kB view hashes)

Uploaded Source

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