Skip to main content

Asynchronous task queueing with Twisted: threaded, multicore, and remote.

Project description

Asynchronous task queueing based on the Twisted framework, with task prioritization and a powerful worker interface. Worker implementations are included for running tasks asynchronously in the main thread, in separate threads, in separate Python interpreters (multiprocessing), and even on separate devices using Twisted's Asynchronous Message Protocol.

Includes deferred iteration capability: Calling a task that returns an iterator can return a Deferator instead, which does the iteration in a Twisted-friendly fashion, even over a network connection. You can also supply an object conforming to Twisted's IConsumer interface and iterations will be fed to it as they become available.

The util module contains a DeferredTracker object that makes the import worthwhile all on its own. You can use its put method to track Twisted Deferred objects without inserting anything into their callback chains. Then you can wait in non-blocking Twisted fashion for all, any, or some of the tracked deferreds to fire (again, without getting tangled up with any of their callbacks) using the tracker's deferToAll, deferToAny, and deferUntilFewer methods.

Includes an example package mcMandelbrot that generates Mandelbrot set images, row by row, demonstrating the power of asynchronous multi-core processing. An instance of ProcessQueue dispatches the computations for each row of pixels to workers running on separate Python processes. The color-mapped RGB results are collected as they come back and intelligently buffered for iterating in a proper sequence to a third-party PNG library that wouldn't ordinarily play nice with Twisted.

You can try things out after installation by running mcmandelbrot (with a few options and arguments) from the console. The output of the script is a PNG file, which you can view by piping to the free Feh image viewer: Just add |feh - at the end of the command line.

There was some effort toward Python 3 compatiblity a while ago, but it's still not yet supported.

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

AsynQueue-0.9.8.tar.gz (136.3 kB view details)

Uploaded Source

File details

Details for the file AsynQueue-0.9.8.tar.gz.

File metadata

  • Download URL: AsynQueue-0.9.8.tar.gz
  • Upload date:
  • Size: 136.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.12.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/2.7.15rc1

File hashes

Hashes for AsynQueue-0.9.8.tar.gz
Algorithm Hash digest
SHA256 fa6ddf179007c195be70b49513d955729e1cea2070414c4fbe31283e8e887e22
MD5 2c12b1dd07cb2fffb4e9d0639d20f492
BLAKE2b-256 ae21907514463fd6f8aba8f6ffebfe7d952089e27a8ed1df6f777cb23f1b5e98

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