Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

A simple async processing helper

Project Description

This module creates a multi-threaded system that you can submit work to, to be executed asyncrhonously. It will return immediately with a Promise that you can periodically check to see if the work is done.

The main idea is to instaniate an instance of the PromiseKeeper and then submit requests for it to do work on your behalf. It will schedule your request to be executed on a thread and return a Promise instance to you. You can look at the Promise to determine the status of the execution.

The PromiseKeeper will track the results (return value) of your requested work and include it in the Promise that it returned to you. If your work request throws an exception, the PromiseKeeper will capture the exception and include that in the Promise as well.

Here’s a quick example:

#!/usr/bin/env python

from promise_keeper import PromiseKeeper
from random import random
from time import sleep

def slow_square(x):
    sleep(random() * 3)
    return x*x

pk = PromiseKeeper()

# doesn't block
promise = pk.submit(slow_square, (10,))

# while the promise is being processed
# you can go on and do other work.

while not promise.is_ready():
    # do other work here.
    print '.',

# Check the result of your work
print promise.get_result()

More documentation and examples can be found here.

Copyright (c) 2017, Steve Brettschneider. License: MIT (see LICENSE for details)

Release History

Release History

This version
History Node

0.3

History Node

0.2

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
promise_keeper-0.3-py2-none-any.whl (4.6 kB) Copy SHA256 Checksum SHA256 py2 Wheel Mar 17, 2017
promise_keeper-0.3.tar.gz (4.0 kB) Copy SHA256 Checksum SHA256 Source Mar 17, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting