Skip to main content

Package for using processes which mimics the threading module

Project description

processing is a package for the Python language which supports the spawning of processes using the API of the standard library’s threading module. It runs on both Unix and Windows.

Features:

  • Objects can be transferred between processes using pipes or multi-producer/multi-consumer queues.

  • Objects can be shared between processes using a server process or (for simple data) shared memory.

  • Equivalents of all the synchronization primitives in threading are available.

  • A Pool class makes it easy to submit tasks to a pool of worker processes.

Examples

The processing.Process class follows the API of threading.Thread. For example

from processing import Process, Queue

def f(q):
    q.put('hello world')

if __name__ == '__main__':
    q = Queue()
    p = Process(target=f, args=[q])
    p.start()
    print q.get()
    p.join()

Synchronization primitives like locks, semaphores and conditions are available, for example

>>> from processing import Condition
>>> c = Condition()
>>> print c
<Condition(<RLock(None, 0)>), 0>
>>> c.acquire()
True
>>> print c
<Condition(<RLock(MainProcess, 1)>), 0>

One can also use a manager to create shared objects either in shared memory or in a server process, for example

>>> from processing import Manager
>>> manager = Manager()
>>> l = manager.list(range(10))
>>> l.reverse()
>>> print l
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
>>> print repr(l)
<Proxy[list] object at 0x00E1B3B0>

Tasks can be offloaded to a pool of worker processes in various ways, for example

>>> from processing import Pool
>>> def f(x): return x*x
...
>>> p = Pool(4)
>>> result = p.map_async(f, range(10))
>>> print result.get(timeout=1)
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]

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

processing-0.40.zip (170.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

processing-0.40.win32-py2.5.exe (184.6 kB view details)

Uploaded Source

processing-0.40.win32-py2.4.exe (183.1 kB view details)

Uploaded Source

File details

Details for the file processing-0.40.zip.

File metadata

  • Download URL: processing-0.40.zip
  • Upload date:
  • Size: 170.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for processing-0.40.zip
Algorithm Hash digest
SHA256 6df42e0aec0f0f054ca66672a6c6bec77c60f023f04290ce7876c9f09cd4fc23
MD5 34e05d9f531208d5d6a9dd9e2b5c276b
BLAKE2b-256 e8c370c81a2a696640588a61a185e18cea46eda6ea917b6cdd6227bf77bd46a3

See more details on using hashes here.

File details

Details for the file processing-0.40.win32-py2.5.exe.

File metadata

File hashes

Hashes for processing-0.40.win32-py2.5.exe
Algorithm Hash digest
SHA256 87b370c4d7e5fdab2b2adb3f6aa0d0992c32225b03f17dfc9531d3376421003f
MD5 04c4c1e0c230706fcd4fc4c53b825a82
BLAKE2b-256 bdd19ab2d6f6985f23b894e0f80086f8b72dd510ef53b38918dfdc6380c6bc3d

See more details on using hashes here.

File details

Details for the file processing-0.40.win32-py2.4.exe.

File metadata

File hashes

Hashes for processing-0.40.win32-py2.4.exe
Algorithm Hash digest
SHA256 c10b9bf856d7258ed8889df1c1404e170c8d0eca0d4816fdf56d76c1c82f62f7
MD5 4cf0a0d47ae96828f24373c186bc9b3f
BLAKE2b-256 28eac3db3f5ffc1e4f1220f6d1661527e3ea25ea6fb99479f561fb2f7e71728d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page