{ "info": { "author": "Samuele Santi", "author_email": "samuele@samuelesanti.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "Steam factory\n#############\n\nReplacement for multiprocessing's Pool, offering more powerful\nfeatures. Allow running a generic Python function asynchronously.\n\n\nExample usage\n=============\n\nFirst, we are going to need a function that does something. In this\ncase, it does nothing more than waiting one second.\n\n.. code-block:: python\n\n import time\n\n def do_nothing():\n time.sleep(1)\n print('Sleeping done') # If you want some feedback..\n\n\nTo run this function in parallel, we're going to need a ``Factory`` instance.\n\n.. code-block:: python\n\n from steamfactory import Factory\n\n # Create a factory, running up to 4 tasks concurrently\n factory = Factory(size=4)\n\nAll set, we can schedule some async function executions:\n\n.. code-block:: python\n\n for _ in range(4):\n factory.run(do_nothing)\n\nAfter a second, you should see the four \"Sleeping done\" messages being\nprinted at once.\n\nIn case you're using this inside a script, and you need the main\nprocess to wait for all tasks to be executed before terminating\n(meaning that tasks will be lost), remember to call the ``shutdown()``\nmethod:\n\n.. code-block:: python\n\n factory.shutdown()\n\n\nGetting feedback\n================\n\nHow to get \"feedback\" from the tasks usually greatly depends on the\napplication. Many times you don't even bother with the function return\nvalue, you just need something to be done. Other times values might be\nlarge, or the required retention time might vary.\n\nThe library doesn't currently offer any way to return results to the\ncaller, but you can easily do something like this:\n\n.. code-block:: python\n\n import time\n from multiprocessing import Manager\n\n from steamfactory import Factory\n\n _mgr = Manager()\n results = _mgr.dict() # Shared between processes\n\n\n def addup(a, b):\n time.sleep(1)\n results[(a, b)] = a + b\n\n # Create a factory, running up to 4 tasks concurrently\n factory = Factory(size=4)\n\n # Let's schedule some tasks\n factory.run(addup, 1, 2)\n factory.run(addup, 3, 4)\n factory.run(addup, 5, 6)\n factory.run(addup, 7, 8)\n\n factory.shutdown()\n\n # Now, results contains all the results (after a 1s processing\n # time)\n\n\nChangelog\n#########\n\n0.1\n===\n\nInitial release, implementing functionality to run functions asynchronously.", "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/rshk/steamfactory", "keywords": null, "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "SteamFactory", "package_url": "https://pypi.org/project/SteamFactory/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/SteamFactory/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/rshk/steamfactory" }, "release_url": "https://pypi.org/project/SteamFactory/0.1/", "requires_dist": null, "requires_python": null, "summary": "Replacement for multiprocessing.Pool.", "version": "0.1" }, "last_serial": 2163834, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "d3158d0ed4d4c82c7994279e8951cff1", "sha256": "6dd859e2038604a4394aa94b553c438a6cf3204a9ba98603cd3b2939283e19bc" }, "downloads": -1, "filename": "SteamFactory-0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "d3158d0ed4d4c82c7994279e8951cff1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 5710, "upload_time": "2016-06-12T21:05:49", "url": "https://files.pythonhosted.org/packages/b7/9d/5834f47a9be60fff01b22661f6ff2d5c3da110697041ecda334fdb7e4dd3/SteamFactory-0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "37572e039607a44be11ffacf1050dd14", "sha256": "955d1eb83f132ac011a8495b9b920e4418f19eaf581ace904e48bbe167255234" }, "downloads": -1, "filename": "SteamFactory-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "37572e039607a44be11ffacf1050dd14", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 5714, "upload_time": "2016-06-12T21:05:41", "url": "https://files.pythonhosted.org/packages/3c/d7/1d36ed221cb0193ca2f5de000003510b7160fe52eea59b5b5b0d4f58a2b9/SteamFactory-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3bef57fb142826ffcf5bbc32c92d2a5a", "sha256": "8c058c6eb59c01ae18dab48362c0d4b055995b5764318490f2acdb84a10795cd" }, "downloads": -1, "filename": "SteamFactory-0.1.tar.gz", "has_sig": false, "md5_digest": "3bef57fb142826ffcf5bbc32c92d2a5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3937, "upload_time": "2016-06-12T21:04:25", "url": "https://files.pythonhosted.org/packages/f3/0e/25692f609584b073e52d40e376f857928dcc0f44e932ae98d770fc3c2fb6/SteamFactory-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d3158d0ed4d4c82c7994279e8951cff1", "sha256": "6dd859e2038604a4394aa94b553c438a6cf3204a9ba98603cd3b2939283e19bc" }, "downloads": -1, "filename": "SteamFactory-0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "d3158d0ed4d4c82c7994279e8951cff1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 5710, "upload_time": "2016-06-12T21:05:49", "url": "https://files.pythonhosted.org/packages/b7/9d/5834f47a9be60fff01b22661f6ff2d5c3da110697041ecda334fdb7e4dd3/SteamFactory-0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "37572e039607a44be11ffacf1050dd14", "sha256": "955d1eb83f132ac011a8495b9b920e4418f19eaf581ace904e48bbe167255234" }, "downloads": -1, "filename": "SteamFactory-0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "37572e039607a44be11ffacf1050dd14", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 5714, "upload_time": "2016-06-12T21:05:41", "url": "https://files.pythonhosted.org/packages/3c/d7/1d36ed221cb0193ca2f5de000003510b7160fe52eea59b5b5b0d4f58a2b9/SteamFactory-0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3bef57fb142826ffcf5bbc32c92d2a5a", "sha256": "8c058c6eb59c01ae18dab48362c0d4b055995b5764318490f2acdb84a10795cd" }, "downloads": -1, "filename": "SteamFactory-0.1.tar.gz", "has_sig": false, "md5_digest": "3bef57fb142826ffcf5bbc32c92d2a5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3937, "upload_time": "2016-06-12T21:04:25", "url": "https://files.pythonhosted.org/packages/f3/0e/25692f609584b073e52d40e376f857928dcc0f44e932ae98d770fc3c2fb6/SteamFactory-0.1.tar.gz" } ] }