{ "info": { "author": "Konrad Ha\u0142as", "author_email": "halas.konrad@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License" ], "description": "========\nlongtask\n========\n\n.. image:: https://travis-ci.org/konradhalas/longtask.png\n :target: https://travis-ci.org/konradhalas/longtask\n\nLong task runner with few nice features.\n\n``longtask`` is a simple framework to run long tasks (eg. data migration, data processing) in console environment.\nDuring process execution you can track changes on progress bar. If something goes wrong or you don't have time now - you\ncan stop task and rerun it later. ``longtask`` collects all your task stats and store it in JSON file.\n\nHow to create task?\n-------------------\n\nIf you want to create task you need to implement derived class from ``longtask.Task``. You also need to override few\nthings:\n\n- ``name`` - task name,\n- ``get_items()`` - this method should return you items collection,\n- ``process_item(item)`` - in this method you can process your item.\n\nSimple example - resize many pictures (``resize.py``):\n\n::\n\n import longtask\n import glob\n from PIL import Image\n\n\n class ResizeTask(longtask.Task):\n name = 'resize'\n\n def get_items(self):\n return glob.glob('*.png')\n\n def process_item(self, item):\n original_image = Image.open(item)\n resized_image = original_image.resize((100, 100))\n resized_image.save('output/' + item)\n\n\n if __name__ == '__main__':\n ResizeTask().run()\n\nNow in directory with ``*.png`` images you can run:\n\n::\n\n $ python resize.py\n [*] Starting task: resize [2013-03-03 18:36:29.953306]\n [*] Processed: 100% (1000/1000) errors: 10% (100/1000) |###################| Elapsed Time: 1:00:00 ETA: 0:00:00\n [*] Finished task: resize [2013-03-03 18:36:30.080421]\n [*] Stats:\n - processed: 100% (1000/1000)\n - success: 90% (900/1000)\n - errors: 10% (100/1000)\n - 100 x IOError with traceback:\n\n Traceback (most recent call last):\n File \"/Users/konradhalas/dev/workspace/personal/longtask/longtask/task.py\", line 59, in run\n self.process_item(item)\n File \"resize.py\", line 13, in process_item\n original_image = Image.open(item)\n File \"/Users/konradhalas/dev/virtualenvs/longtask/lib/python2.7/site-packages/PIL/Image.py\", line 1980, in open\n raise IOError(\"cannot identify image file\")\n IOError: cannot identify image file\n\nIn our example we resized 1000 files - 100 of them have corrupted data (``IOError``). This task took 1h.\n\nYou can always stop task with ``Ctrl+C`` and rerun it later with flag ``-c``. If some errors occured durring execution\nyou can rerun it with flag ``-e`` (it works only with flag ``-c``).\n\nLicense\n-------\n\nCopyright [2013] [Konrad Ha\u0142as]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n", "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/konradhalas/longtask", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "longtask", "package_url": "https://pypi.org/project/longtask/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/longtask/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/konradhalas/longtask" }, "release_url": "https://pypi.org/project/longtask/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Long task runner.", "version": "0.1.1" }, "last_serial": 933349, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "fee7b5b701cebe17814687e53e5392b5", "sha256": "d08cd6563493d442c8587e6bc38a4ebd56f3ece0b00176770db54577b5ea0b6f" }, "downloads": -1, "filename": "longtask-0.1.1.tar.gz", "has_sig": false, "md5_digest": "fee7b5b701cebe17814687e53e5392b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4942, "upload_time": "2013-12-01T22:23:36", "url": "https://files.pythonhosted.org/packages/08/e9/d607881b6aa2fe9d7c9b8358fd371f4b46a02e4f67004b1aadc78017c0f3/longtask-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fee7b5b701cebe17814687e53e5392b5", "sha256": "d08cd6563493d442c8587e6bc38a4ebd56f3ece0b00176770db54577b5ea0b6f" }, "downloads": -1, "filename": "longtask-0.1.1.tar.gz", "has_sig": false, "md5_digest": "fee7b5b701cebe17814687e53e5392b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4942, "upload_time": "2013-12-01T22:23:36", "url": "https://files.pythonhosted.org/packages/08/e9/d607881b6aa2fe9d7c9b8358fd371f4b46a02e4f67004b1aadc78017c0f3/longtask-0.1.1.tar.gz" } ] }