PKG-INFO 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. Metadata-Version: 1.0
  2. Name: processing
  3. Version: 0.52
  4. Summary: Package for using processes which mimics the threading module
  5. Home-page: http://developer.berlios.de/projects/pyprocessing
  6. Author: R Oudkerk
  7. Author-email: roudkerk at users.berlios.de
  8. License: BSD Licence
  9. Description: `processing` is a package for the Python language which supports the
  10. spawning of processes using the API of the standard library's
  11. `threading` module. It runs on both Unix and Windows.
  12. Features:
  13. * Objects can be transferred between processes using pipes or
  14. multi-producer/multi-consumer queues.
  15. * Objects can be shared between processes using a server process or
  16. (for simple data) shared memory.
  17. * Equivalents of all the synchronization primitives in `threading`
  18. are available.
  19. * A `Pool` class makes it easy to submit tasks to a pool of worker
  20. processes.
  21. Links
  22. =====
  23. * `Documentation <http://pyprocessing.berlios.de/doc/index.html>`_
  24. * `Installation instructions <http://pyprocessing.berlios.de/doc/INSTALL.html>`_
  25. * `Changelog <http://pyprocessing.berlios.de/doc/CHANGES.html>`_
  26. * `Acknowledgments <http://pyprocessing.berlios.de/doc/THANKS.html>`_
  27. * `BSD Licence <http://pyprocessing.berlios.de/doc/COPYING.html>`_
  28. The project is hosted at
  29. * http://developer.berlios.de/projects/pyprocessing
  30. The package can be downloaded from
  31. * http://developer.berlios.de/project/filelist.php?group_id=9001 or
  32. * http://pypi.python.org/pypi/processing
  33. Examples
  34. ========
  35. The `processing.Process` class follows the API of `threading.Thread`.
  36. For example ::
  37. from processing import Process, Queue
  38. def f(q):
  39. q.put('hello world')
  40. if __name__ == '__main__':
  41. q = Queue()
  42. p = Process(target=f, args=[q])
  43. p.start()
  44. print q.get()
  45. p.join()
  46. Synchronization primitives like locks, semaphores and conditions are
  47. available, for example ::
  48. >>> from processing import Condition
  49. >>> c = Condition()
  50. >>> print c
  51. <Condition(<RLock(None, 0)>), 0>
  52. >>> c.acquire()
  53. True
  54. >>> print c
  55. <Condition(<RLock(MainProcess, 1)>), 0>
  56. One can also use a manager to create shared objects either in shared
  57. memory or in a server process, for example ::
  58. >>> from processing import Manager
  59. >>> manager = Manager()
  60. >>> l = manager.list(range(10))
  61. >>> l.reverse()
  62. >>> print l
  63. [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
  64. >>> print repr(l)
  65. <Proxy[list] object at 0x00E1B3B0>
  66. Tasks can be offloaded to a pool of worker processes in various ways,
  67. for example ::
  68. >>> from processing import Pool
  69. >>> def f(x): return x*x
  70. ...
  71. >>> p = Pool(4)
  72. >>> result = p.mapAsync(f, range(10))
  73. >>> print result.get(timeout=1)
  74. [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
  75. Platform: Unix and Windows
  76. Classifier: Development Status :: 4 - Beta
  77. Classifier: Intended Audience :: Developers
  78. Classifier: Programming Language :: Python