Concurrency module which provides the same interface for threads and process.
Multiprocessing is available for Python 2.6 and above via the multiprocessing library. Adaped from the Python standard library and Celery.
To obtain an instance of unuk.concurrency.ConcurrentPool you can used the shortcut function
Base class for managing queue with several concurrent threads or processes.
type of worker, “process” or “thread”
The soft time limit has been exceeded. This exception is raised to give the task a chance to clean up.
alias of Finalize
Factory class for worker processes.
Pool state, one of NOT_STARTED=-1, RUN=0, CLOSE=1, TERMINATED=2.
Number of workers
Approximate size of task queue
True is pool has started.
True is pool has joined.
Equivalent of apply() builtin
Start the pool. If the pool was already started an AlreadyStarted exception will be raised.
Bring the number of pool processes up to the specified number, for use after reaping workers which have exited.
Asynchronous equivalent of apply() builtin. Call a callable object in a separate worker.
- func: callable object to be called on a pool worker.
- args: tuple of positional arguments to be passed to func.
- kwds: dictionary of keyword arguments to be passed to func.
- callback: functions called when the func return its value.
- accept_callback: called when the job is accepted to be executed.
- timeout_callback: called when the job has timeout.
- error_callback: called when the job has failed.
Close the pool.