Module promises.multiprocess

Multi-process Promises for Python

author:Christopher O’Brien <obriencj@gmail.com>
license:LGPL v.3
class promises.multiprocess.ProcessExecutor(processes=None)[source]

Bases: object

Create promises which will deliver in a separate process.

deliver()[source]

Deliver on all underlying promises. Blocks until complete.

future(work, *args, **kwds)[source]

Promise to deliver on the results of work in the future.

Parameters:

work : callable

This is the work which will be performed to deliver on the future.

*args : optional positional parameters

arguments to the work function

**kwds : optional named parameters

keyword arguments to the work function

Returns:

value : promise

a promise acting as a placeholder for the result of evaluating work(*args, **kwds). Note that calling deliver on this promise will potentially block until the underlying result is available.

terminate()[source]

Breaks all the remaining undelivered promises, halts execution of any parallel work being performed.

Any promise which had not managed to be delivered will never be delivered after calling terminate. Attempting to call deliver on them will result in a deadlock.

class promises.multiprocess.ProxyProcessExecutor(processes=None)[source]

Bases: promises.multiprocess.ProcessExecutor

Create transparent proxy promises which will deliver in a separate process.

Previous topic

Module promises

Next topic

Module promises.multithread

This Page