{ "info": { "author": "Ryan Johnson", "author_email": "escattone@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Twisted", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2 :: Only", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "txpool\n======\n\nSummary\n-------\n\nA Python persistent process pool for use with\n`Twisted `__. Provides the ability to run\nPython callables asynchronously within a pool of persistent processes,\nas long as the callable, its arguments, and its return value are all\npicklable.\n\nInstalling\n----------\n\n.. code:: sh\n\n pip install txpool\n\nor\n\n.. code:: sh\n\n python setup.py install\n\nExamples\n--------\n\nHere are some simple examples to give you the idea:\n\n.. code:: python\n\n import glob\n from twisted.internet import reactor\n from twisted.internet.defer import inlineCallbacks\n import txpool\n\n pool = txpool.Pool()\n\n @inlineCallbacks\n def main():\n result = yield pool.apply_async(glob.glob, ('*.pdf',))\n print result\n reactor.stop()\n\n reactor.callWhenRunning(main)\n reactor.run()\n\nThe callable can instead be specified as a string, using dotted notation\nto specify the full path to the callable.\n\n.. code:: python\n\n from twisted.internet import reactor\n from twisted.internet.defer import inlineCallbacks\n import txpool\n\n pool = txpool.Pool()\n\n @inlineCallbacks\n def main():\n # You can provide an optional timeout (in seconds) for the call\n # (the default is None).\n try:\n result = yield pool.apply_async('glob.glob', ('*.pdf',), timeout=5)\n except PoolTimeout as e:\n result = e\n print result\n reactor.stop()\n\n reactor.callWhenRunning(main)\n reactor.run()\n\nThe *txpool.Pool* class can be explicitly sized, asked to log its\nactions, and/or given a custom name.\n\n.. code:: python\n\n import logging\n from twisted.internet import reactor\n from twisted.internet.defer import inlineCallbacks, gatherResults\n import txpool\n\n logger = logging.getLogger('example')\n logger.addHandler(logging.StreamHandler())\n logger.setLevel(logging.DEBUG)\n\n pool = txpool.Pool(size=5, log=logger, name='twisting-by-the-pool')\n\n @inlineCallbacks\n def main():\n calls = ('math.factorial',) * 5\n args = [(n,) for n in range(150780, 150785)]\n\n # You can wait until the pool is at full-strength (providing an\n # optional timeout if desired), but it's not required before\n # calling the \"apply_async\" method. Jobs are queued until a\n # worker process is available.\n try:\n yield pool.on_ready(timeout=10)\n except PoolTimeout as e:\n results = e\n else:\n results = yield gatherResults(map(pool.apply_async, calls, args))\n\n print results\n\n try:\n # You can gracefully close the pool, which ensures all jobs\n # already queued are completed before shutting down...\n yield pool.close(timeout=10)\n except PoolTimeout as e:\n print e\n # ...or you can use force and immediately send SIGKILL to each\n # process in the pool.\n yield pool.terminate(timeout=10)\n\n reactor.stop()\n\n reactor.callWhenRunning(main)\n reactor.run()", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/escattone/txpool", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "txpool", "package_url": "https://pypi.org/project/txpool/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/txpool/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/escattone/txpool" }, "release_url": "https://pypi.org/project/txpool/0.9/", "requires_dist": null, "requires_python": null, "summary": "A persistent process pool for Twisted", "version": "0.9" }, "last_serial": 1399480, "releases": { "0.9": [ { "comment_text": "", "digests": { "md5": "8123da45af40ed2dfef3c2049650ea0d", "sha256": "5377461b57f6d0db0245cb65dfa68fa22dfd9e704328e1c2462cdf02e67e5da2" }, "downloads": -1, "filename": "txpool-0.9-py2-none-any.whl", "has_sig": false, "md5_digest": "8123da45af40ed2dfef3c2049650ea0d", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11705, "upload_time": "2015-01-28T01:21:53", "url": "https://files.pythonhosted.org/packages/5c/87/0e9608062ce97bd97fb0bf8ebb0a8683ab4418f5e049fbd870f0f2a1555b/txpool-0.9-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f61ffe48335e698d825c15345f350899", "sha256": "e2847c67c10f1f44d7a2394afac653fa772564d305c36c3c089f1ea1ff85f3db" }, "downloads": -1, "filename": "txpool-0.9.tar.gz", "has_sig": false, "md5_digest": "f61ffe48335e698d825c15345f350899", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10244, "upload_time": "2015-01-28T01:21:51", "url": "https://files.pythonhosted.org/packages/57/e5/a4f40f6c6d8dc8b849cdca45cc4fba9c23b0417ada37b20835ed436fbc08/txpool-0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8123da45af40ed2dfef3c2049650ea0d", "sha256": "5377461b57f6d0db0245cb65dfa68fa22dfd9e704328e1c2462cdf02e67e5da2" }, "downloads": -1, "filename": "txpool-0.9-py2-none-any.whl", "has_sig": false, "md5_digest": "8123da45af40ed2dfef3c2049650ea0d", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11705, "upload_time": "2015-01-28T01:21:53", "url": "https://files.pythonhosted.org/packages/5c/87/0e9608062ce97bd97fb0bf8ebb0a8683ab4418f5e049fbd870f0f2a1555b/txpool-0.9-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f61ffe48335e698d825c15345f350899", "sha256": "e2847c67c10f1f44d7a2394afac653fa772564d305c36c3c089f1ea1ff85f3db" }, "downloads": -1, "filename": "txpool-0.9.tar.gz", "has_sig": false, "md5_digest": "f61ffe48335e698d825c15345f350899", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10244, "upload_time": "2015-01-28T01:21:51", "url": "https://files.pythonhosted.org/packages/57/e5/a4f40f6c6d8dc8b849cdca45cc4fba9c23b0417ada37b20835ed436fbc08/txpool-0.9.tar.gz" } ] }