{ "info": { "author": "Abbasov Alexander", "author_email": "abbasovalex@{nospam}gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP" ], "description": "JobtasticMixins\n===============\n\n## Package includes:\n\n#### AVGTimeRedis class\nThe class that helps automate calculate an avarage time\nfor different kind tasks and saves result into Redis DB\n\n\n## Install\nInstall from Github\n\n```pip install https://github.com/abbasovalex/JobtasticMixins/archive/master.zip```\n\n\n## Usage\n\n1. You must will add the mixin class as first argument\n2. You should set ```default_avg_time``` in the seconds \n3. You must use ```self.update_progress()``` without arguments\n\n```python\nclass YourTask(AVGTimeRedis, JobtasticTask):\n default_avg_time = 60 # 1 minute\n \n ...\n \n def calculate_result(self, ..., **kwargs):\n ...\n```\n\n```default_avg_time``` used when task still never calculated\nIt will be encompass arithmetical mean after task was executed.\nForecast accuracy depends from count executed tasks \n\n\n### Example with AVGTimeRedis class\n\nThe class that helps automate calculate an avarage time for different kind\ntasks and saves result into Redis DB\n\nLet's take a look at the example task using with JobtasticMixins and\nAVGTimeRedis class:\n\n``` python\nfrom time import sleep\nfrom jobtastic import JobtasticTask\nfrom jobtasticmixins import AVGTimeRedis\n\n\nclass LotsOfDivisionTask(AVGTimeRedis, JobtasticTask):\n \"\"\"\n Division is hard. Make Celery do it a bunch.\n \"\"\"\n significant_kwargs = [\n ('numerators', str),\n ('denominators', str),\n ]\n herd_avoidance_timeout = 60\n cache_duration = 0\n # optional variable was added. by default is 30 seconds \n default_avg_time = 90\n\n def calculate_result(self, numerators, denominators, **kwargs):\n results = []\n for count, divisors in enumerate(zip(numerators, denominators)):\n numerator, denominator = divisors\n results.append(numerator / denominator)\n # it will be auto calculated\n self.update_progress()\n sleep(0.1)\n\n # set finish=True for avoid trouble\n self.update_progress(finish=True)\n return results\n\n```\n\nUnder the hood:\n\n1. AVGTimeRedis gets settings.BROKER_URL and connects to Redis \n2. It counts the tasks and the workers and uses to calculating \n\nMore details you can see into [source](https://github.com/abbasovalex/JobtasticMixins/blob/master/jobtasticmixins/mixins.py)", "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/abbasovalex/JobtasticMixins", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "jobtastic-mixins", "package_url": "https://pypi.org/project/jobtastic-mixins/", "platform": "any", "project_url": "https://pypi.org/project/jobtastic-mixins/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/abbasovalex/JobtasticMixins" }, "release_url": "https://pypi.org/project/jobtastic-mixins/0.1/", "requires_dist": null, "requires_python": null, "summary": "Provides ability calculate average time of tasks", "version": "0.1" }, "last_serial": 1470467, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "45c76cd8f2bd3d3670143f460beb797a", "sha256": "0880b6e82e3a6d87b4bca80cfbde5673052c45e23395c72e44b4facd0736eb4d" }, "downloads": -1, "filename": "jobtastic-mixins-0.1.tar.gz", "has_sig": false, "md5_digest": "45c76cd8f2bd3d3670143f460beb797a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5202, "upload_time": "2015-03-20T18:07:47", "url": "https://files.pythonhosted.org/packages/6c/43/aa1111aa9c8ce3e3874692df3accc00786adbc4c3609f7239b25dd08d007/jobtastic-mixins-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "45c76cd8f2bd3d3670143f460beb797a", "sha256": "0880b6e82e3a6d87b4bca80cfbde5673052c45e23395c72e44b4facd0736eb4d" }, "downloads": -1, "filename": "jobtastic-mixins-0.1.tar.gz", "has_sig": false, "md5_digest": "45c76cd8f2bd3d3670143f460beb797a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5202, "upload_time": "2015-03-20T18:07:47", "url": "https://files.pythonhosted.org/packages/6c/43/aa1111aa9c8ce3e3874692df3accc00786adbc4c3609f7239b25dd08d007/jobtastic-mixins-0.1.tar.gz" } ] }