{ "info": { "author": "Akgnah", "author_email": "1024@setq.me", "bugtrack_url": null, "classifiers": [], "description": "uCron\n=====\n\nuCron \u662f\u4e00\u4e2a\u5fae\u578b\u7684\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\uff08Crontab\uff09\u548c\u4efb\u52a1\u961f\u5217\uff08Task queue\uff09\u7684\u5c0f\u5de5\u5177\uff0c\u6613\u4e8e\u5b89\u88c5\u548c\u8fd0\u884c\uff0c\u914d\u7f6e\u7b80\u5355\u4e14\u4f9d\u8d56\u5c11\u3002\n\n\u7279\u522b\u5730\uff0c\u5982\u679c\u4f60\u4f7f\u7528 Windows\uff0c\u6ca1\u6709 Crontab\uff0c\u8fd9\u4e2a\u5c0f\u5de5\u5177\u80fd\u4e3a\u4f60\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\u3002\u5f53\u7136\u5b83\u4e5f\u53ef\u5728 Linux \u4e0a\u5de5\u4f5c\u3002\n\n\u5b89\u88c5\n----\n\n.. code-block:: bash\n\n $ pip install ucron\n\n\u7a0b\u5e8f\u4f9d\u8d56 bottle\uff0c\u5728 Win10 \u4e0a\uff0cPython2.7 \u548c 3.5+ \u6d4b\u8bd5\u901a\u8fc7\uff0c\u5728 Archlinux \u4e0a\uff0cPython2.7 \u548c 3.3+ \u6d4b\u8bd5\u901a\u8fc7\u3002\n\n\u4f7f\u7528\n----\n\n.. code-block:: bash\n\n $ python -m ucron\n\n\u8fd9\u662f\u6700\u7b80\u5355\u7684\u4f7f\u7528\u65b9\u6cd5\uff0c\u4f7f\u7528\u6d4f\u89c8\u5668\u8bbf\u95ee http://127.0.0.1:8089/ \u5c06\u4f1a\u770b\u5230\u4e00\u4e2a\u7b80\u5355\u7684\u6b22\u8fce\u9875\u9762\u3002\n\n\u8fd0\u884c python -m ucron -h \u53ef\u67e5\u770b\u5168\u90e8\u53ef\u7528\u53c2\u6570\uff0c\u7b80\u5355\u8bf4\u660e\u5982\u4e0b\uff1a\n\n::\n\n --host \u6307\u5b9a\u7a0b\u5e8f\u8fd0\u884c\u7684 IP\uff0c\u9ed8\u8ba4\u4e3a 127.0.0.1\u3002\n --port \u6307\u5b9a\u7a0b\u5e8f\u8fd0\u884c\u7684\u7aef\u53e3\uff0c\u9ed8\u8ba4\u4e3a 8089\u3002\n --cron \u6307\u5b9a\u5b9a\u65f6\u4efb\u52a1\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u683c\u5f0f\u89c1 ucron.tab \u6216\u4e0b\u6587\u3002\n --dbn \u6307\u5b9a\u6587\u4ef6\u7528\u4e8e SQLite\uff0c\u9ed8\u8ba4\u4e3a :memory:\uff0c\u5373\u5185\u5b58\u6a21\u5f0f\u3002\n --log \u6307\u5b9a\u65e5\u5fd7\u6587\u4ef6\uff0c\u9ed8\u8ba4\u4e3a\u5f53\u524d\u76ee\u5f55\u4e0b\u7684 ucron.log\u3002\n --max \u6307\u5b9a\u65e5\u5fd7\u6587\u4ef6\u7684\u6700\u5927\u884c\u6570\uff0c\u9ed8\u8ba4\u4e3a 10240\u3002\n --utc \u6307\u5b9a\u65f6\u533a\uff0c\u9ed8\u8ba4\u4e3a +8\u3002\n --quiet \u6307\u5b9a bottle \u7684 quiet \u9009\u9879\uff0c\u9ed8\u8ba4\u4e3a False\u3002\n --reload \u6307\u5b9a\u662f\u5426\u81ea\u52a8\u91cd\u8f7d ucron.tab\uff0c\u9ed8\u8ba4\u4e3a False\u3002\n --tab \u6307\u5b9a\u6e05\u7406\u65e5\u5fd7\u6587\u4ef6\u7684\u6267\u884c\u5468\u671f\uff0c\u9ed8\u8ba4\u4e3a\u6bcf\u5929\u65e9\u4e0a 5 \u70b9\u3002\n --add \u589e\u52a0\u961f\u5217\uff0c\u9700\u6307\u5b9a\u7aef\u53e3\u3001\u961f\u5217\u540d\u548c\u7c7b\u578b\u3002\n --cls \u6e05\u7a7a\u961f\u5217\uff0c\u9700\u6307\u5b9a\u7aef\u53e3\u548c\u961f\u5217\u540d\u3002\n --del \u5220\u9664\u961f\u5217\uff0c\u9700\u6307\u5b9a\u7aef\u53e3\u548c\u961f\u5217\u540d\u3002\n --list \u5217\u51fa\u5168\u90e8\u961f\u5217\u548c\u5b83\u4eec\u7684\u5269\u4f59\u957f\u5ea6\uff0c\u9700\u6307\u5b9a\u7aef\u53e3\u3002\n\n\u8bf7\u6ce8\u610f\uff0c\u5f53 SQLite \u4f7f\u7528\u5185\u5b58\u6a21\u5f0f\uff0c\u5373 --dbn \u4f7f\u7528\u9ed8\u8ba4\u503c\u65f6\uff0c\u7a0b\u5e8f\u5173\u95ed\u65f6\u4f1a\u4e22\u5931\u961f\u5217\u3002\n\n\u5178\u578b\u7684\u4f7f\u7528\u65b9\u6cd5\u53ef\u80fd\u662f\u8fd9\u6837\uff1a\n\n.. code-block:: bash\n\n $ python -m ucron --cron ucron.tab\n\n\u8fd9\u4f1a\u8bfb\u53d6\u5f53\u524d\u76ee\u5f55\u4e0b\u7684 ucron.tab \u589e\u52a0\u5b9a\u65f6\u4efb\u52a1\u3002\u6307\u5b9a\u7684\u6587\u4ef6\u53ef\u4f7f\u7528\u76f8\u5bf9\u6216\u7edd\u5bf9\u8def\u5f84\u3002\n\n\u5b9a\u65f6\u4efb\u52a1\n^^^^^^^^\n\n::\n\n */10 * * * * https://httpbin.org/post hello=world&text=test POST\n\n\u8fd9\u662f ucron.tab \u4e2d\u7684\u4e00\u884c\uff0c\u5b83\u4f7f\u7528\u548c Crontab \u7c7b\u4f3c\u7684\u683c\u5f0f\uff0c\u6bcf\u884c\u4e3a\u4e00\u4e2a\u4efb\u52a1\uff0c\u6bcf\u4e2a\u4efb\u52a1\u6709\u56db\u4e2a\u90e8\u5206\uff0c\u4f7f\u7528\u7a7a\u683c\u5206\u9694\uff0c\u6700\u540e\u4e24\u4e2a\u90e8\u5206\u5747\u4e3a\u53ef\u9009\u3002\n\n\u7b2c\u4e00\u90e8\u5206\u662f\u6267\u884c\u5468\u671f\uff0c\u4f7f\u7528\u548c\u6807\u51c6 Crontab \u4e00\u81f4\u7684\u683c\u5f0f\uff1b\u7b2c\u4e8c\u90e8\u5206\u662f\u8981\u8bbf\u95ee\u7684\u5730\u5740\uff1b\u7b2c\u4e09\u90e8\u5206\u662f\u63d0\u4f9b\u7ed9\u5730\u5740\u7684\u6570\u636e\uff0c\u4f7f\u7528 key1=value1&key2=value2 \u7684\u683c\u5f0f\uff1b\u6700\u540e\u4e00\u90e8\u5206\u662f\u8bbf\u95ee\u65b9\u6cd5\uff0c\u53ef\u4e3a GET \u6216 POST\uff0c\u9ed8\u8ba4\u4e3a GET\u3002\u7b2c\u4e09\u3001\u56db\u90e8\u5206\u5747\u4e3a\u53ef\u9009\uff0c\u4e5f\u53ef\u5ffd\u7565\u7b2c\u4e09\u90e8\u5206\u76f4\u63a5\u63d0\u4f9b\u7b2c\u56db\u90e8\u5206\u3002\n\n\u8bf7\u6ce8\u610f\u5404\u4e2a\u90e8\u5206\u4f7f\u7528\u7a7a\u683c\u6765\u5206\u9694\uff0c\u4e5f\u6b63\u56e0\u4e3a\u5982\u6b64\uff0c\u6240\u4ee5 URL \u6216\u53c2\u6570\u4e2d\u4e0d\u80fd\u542b\u6709\u7a7a\u683c\u3002\u8bfb\u53d6\u914d\u7f6e\u65f6\u4f1a\u5ffd\u7565\u4ee5 # \u5f00\u59cb\u7684\u884c\u3002\n\n\u5982\u679c\u5728\u8fd0\u884c\u4e2d\u4fee\u6539\u4e86\u8be5\u914d\u7f6e\u6587\u4ef6\uff0c\u5e76\u4e14\u6ca1\u6709\u6307\u5b9a --reload \u4e3a\u771f\uff0c\u90a3\u4e48\u9700\u8981\u8bbf\u95ee http://127.0.0.1:8089/reload \u4ee5\u4f7f\u914d\u7f6e\u751f\u6548\uff08\u5047\u8bbe\u4f7f\u7528\u4e86\u9ed8\u8ba4\u7aef\u53e3 8089\uff0c\u4e0b\u540c\uff09\u3002\u8fd8\u6709\u4e00\u70b9\u5f88\u91cd\u8981\uff0c\u8bf7\u4f7f\u7528 UTF-8 \u7f16\u7801\u4fdd\u5b58 ucron.tab\u3002\n\n\u5982\u679c\u4f60\u4e0d\u719f\u6089 Crontab \u683c\u5f0f\uff0c\u8fd9\u4e2a\u5728\u7ebf `Crontab \u7f16\u8f91\u5668 `_ \u53ef\u80fd\u4f1a\u6709\u5e2e\u52a9\u3002\n\n\n\u4efb\u52a1\u961f\u5217\n^^^^^^^^\n\n\u8981\u6dfb\u52a0\u4efb\u52a1\u5230\u961f\u5217\u4e2d\u5f88\u7b80\u5355\uff1a\n\n.. code-block:: python\n\n from ucron import add_task\n\n body = {'page': 1, 'text': '\u6d4b\u8bd5'}\n resp = add_task('http://setq.me', body, method='GET')\n print(resp)\n\nadd_task \u65b9\u6cd5\u63a5\u53d7\u7684\u53c2\u6570\u6709 path\u3001args\u3001method\u3001name\u3001port\u3001host \u548c json\uff0c\u5176\u4e2d\u53ea\u6709 path \u662f\u5fc5\u9700\u7684\uff0c\u5176\u4ed6\u5747\u4e3a\u53ef\u9009\u53c2\u6570\u3002\n\npath \u662f\u8981\u8bbf\u95ee\u7684\u5730\u5740\uff0cargs \u4e3a\u53d1\u9001\u7ed9\u5730\u5740\u7684\u6570\u636e\uff0c\u63a5\u53d7\u4e00\u4e2a\u5b57\u5178\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0cmethod \u53ef\u4e3a GET \u6216 POST\uff0c\u9ed8\u8ba4\u4e3a GET\u3002\n\nname \u662f\u961f\u5217\u540d\uff0c\u9ed8\u8ba4\u4e3a default_seq\uff0c\u8fd9\u4e2a\u53c2\u6570\u5728\u4e0b\u9762\u4f1a\u6709\u8be6\u7ec6\u8bf4\u660e\u3002port \u9ed8\u8ba4\u4e3a 8089\uff0chost \u9ed8\u8ba4\u4e3a 127.0.0.1\u3002\n\n\u5728\u6700\u65b0\u7248\u672c\u4e2d\uff0c\u4f60\u8fd8\u53ef\u4ee5\u628a\u5b57\u5178\u4f20\u7ed9 add_task \u7684 json \u53c2\u6570\uff0c\u6b64\u65f6\u4f1a\u628a Content-Type header \u8bbe\u7f6e\u4e3a application/json \u5e76\u53d1\u9001 POST \u8bf7\u6c42\u3002 \n\n\n\u961f\u5217\u7c7b\u578b\n^^^^^^^^\n\nuCron \u4e2d\u7684\u4efb\u52a1\u961f\u5217\u6709\u987a\u5e8f\u961f\u5217\u548c\u5e76\u53d1\u961f\u5217\u4e24\u79cd\u7c7b\u578b\u3002\u7a0b\u5e8f\u5728\u8fd0\u884c\u7684\u65f6\u5019\u4f1a\u65b0\u5efa\u4e24\u4e2a\u9ed8\u8ba4\u7684\u961f\u5217\uff0cdefault_seq \u548c default_con\uff0c\u5206\u522b\u5bf9\u5e94\u7740\u987a\u5e8f\u961f\u5217\u548c\u5e76\u53d1\u961f\u5217\u3002\u4f60\u4e5f\u53ef\u4ee5\u81ea\u5df1\u589e\u52a0\u961f\u5217\u5e76\u5728 add_task \u4e2d\u6307\u5b9a name \u53c2\u6570\u3002\n\n\u6709\u4e09\u79cd\u65b9\u6cd5\u521b\u5efa\u961f\u5217\uff1a\n\n.. code-block:: bash\n\n $ python -m ucron --add 8089 bot_seq seq\n\n\u8fd9\u4f1a\u5411 8089 \u7aef\u53e3\u8fd0\u884c\u7740\u7684 uCron \u589e\u52a0\u4e00\u4e2a\u540d\u4e3a bot_seq \u7684\u987a\u5e8f\uff08seq\uff09\u961f\u5217\u3002\n\n.. code-block:: python\n\n from ucron import add_queue\n\n add_queue('bot_con', 'con', port='8089')\n\n\u8fd9\u4f1a\u5411 8089 \u7aef\u53e3\u8fd0\u884c\u7740\u7684 uCron \u589e\u52a0\u4e00\u4e2a\u540d\u4e3a bot_con \u7684\u5e76\u53d1\uff08con\uff09\u961f\u5217\u3002\n\n\u5411\u65b0\u5efa\u7684\u961f\u5217\u6dfb\u52a0\u4efb\u52a1\uff1a\n\n.. code-block:: python\n\n from ucron import add_task\n\n for i in range(500): # \u987a\u5e8f\u961f\u5217\n body = {'page': i}\n add_task('http://setq.me', body, name='bot_seq')\n\n for i in range(500): # \u5e76\u53d1\u961f\u5217\n body = {'page': i}\n add_task('http://setq.me', body, name='bot_con')\n\n\u540c\u6837\u4e5f\u6709\u4e09\u79cd\u65b9\u6cd5\u5220\u9664\u961f\u5217\uff1a\n\n.. code-block:: bash\n\n $ python -m ucron --del 8089 bot_seq\n\n\u8fd9\u4f1a\u5220\u9664\u521a\u624d\u589e\u52a0\u7684 bot_seq \u961f\u5217\u3002\n\n.. code-block:: python\n\n from ucron import del_queue\n\n del_queue('bot_con', port='8089')\n\n\u8fd9\u4f1a\u5220\u9664\u521a\u624d\u589e\u52a0\u7684 bot_con \u961f\u5217\u3002\n\n\u7b2c\u4e8c\u79cd\u65b9\u6cd5\u4e3a\u4ee3\u7801\u5728\u8fd0\u884c\u65f6\u4e34\u65f6\u589e\u5220\u961f\u5217\u63d0\u4f9b\u4e86\u4fbf\u5229\u3002\u7b2c\u4e09\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u6d4f\u89c8\u5668\u8bbf\u95ee http://127.0.0.1:8089/ \u8fdb\u884c\u64cd\u4f5c\u3002\u63d0\u9192\u4e00\u4e0b\uff0c\u5e76\u53d1\u961f\u5217\u4e0d\u4fdd\u8bc1\u4e25\u683c\u6709\u5e8f\u3002\n\nadd_task\u3001add_queue \u548c del_queue \u5747\u5b9a\u4e49\u5728 ucron/ext.py \u4e2d\uff0c\u5b83\u4eec\u90fd\u5f88\u7b80\u5355\uff0c\u8bf7\u67e5\u770b\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u60c5\u3002\n\n\n\u6742\u9879\n----\n\u8fd9\u4e2a\u5c0f\u5de5\u5177\u4ea7\u751f\u4e8e\u6211\u5199\u996d\u5426\u673a\u5668\u4eba\u7684\u8fc7\u7a0b\u4e2d\uff0c\u7531\u4e8e\u5f53\u65f6\u4e0d\u77e5\u9053\u5df2\u7ecf\u5b58\u5728\u5f88\u591a\u4f18\u79c0\u7684\u7c7b\u4f3c\u5de5\u5177\uff0c\u5982 `schedule `_ \u548c `Celery `_ \uff0c\u6240\u4ee5\u91cd\u590d\u9020\u4e86\u8f6e\u5b50\uff0c\u4f46\u9020\u8f6e\u5b50\u8fd8\u662f\u633a\u5f00\u5fc3\u7684\u3002\n\n\u6700\u540e\uff0c\u611f\u8c22\u4f7f\u7528\uff0c\u82e5\u6709\u7591\u95ee\u6216\u5efa\u8bae\u8bf7 Email \u8054\u7cfb\u6211\u3002\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/akgnah/ucron", "keywords": "crontab task queue", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ucron", "package_url": "https://pypi.org/project/ucron/", "platform": "any", "project_url": "https://pypi.org/project/ucron/", "project_urls": { "Homepage": "http://github.com/akgnah/ucron" }, "release_url": "https://pypi.org/project/ucron/0.1.3/", "requires_dist": [ "bottle" ], "requires_python": "", "summary": "A micro Crontab & Task Queue for Python Web.", "version": "0.1.3" }, "last_serial": 4431308, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "8b6ee405e4ef089bd9c415f42a40483f", "sha256": "104d0f32f89e346f2f56e78d191d5db7929038d2be0d23eb4b926398560c1449" }, "downloads": -1, "filename": "ucron-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8b6ee405e4ef089bd9c415f42a40483f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18505, "upload_time": "2017-08-26T06:18:45", "url": "https://files.pythonhosted.org/packages/d8/5c/6075bd372c916bcfff070914cc74a35a09572d5b3864a60c2b1168d6ba69/ucron-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "78e6e6dc9bbb0ad999884edd196b2250", "sha256": "b83732c8483440d6473e88e20d3fc8b80d22331f842eece7d1d586371538bb90" }, "downloads": -1, "filename": "ucron-0.1.1.tar.gz", "has_sig": false, "md5_digest": "78e6e6dc9bbb0ad999884edd196b2250", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15149, "upload_time": "2017-08-26T06:18:48", "url": "https://files.pythonhosted.org/packages/e3/01/a79e5307aa5e9504655f6e019d6e0129ec27ea59ef7577c13b8e414c46b3/ucron-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "9a859f4219273153246492c5a064753b", "sha256": "1bf6db1b1c696fb7a9d0ac139030ad9c54d79719923aed056f255ab8ee7a6cc8" }, "downloads": -1, "filename": "ucron-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9a859f4219273153246492c5a064753b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18879, "upload_time": "2017-11-23T08:03:48", "url": "https://files.pythonhosted.org/packages/13/11/6242f9ee22020305bd5994e4c8f187c72cfb2f854925eb14a7b394ac097b/ucron-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b136deca7762702c178be0a253e6338", "sha256": "24b717077422fe884199b5c1ddfeff5862bf1216fba9640ae6e093729906915b" }, "downloads": -1, "filename": "ucron-0.1.2.tar.gz", "has_sig": false, "md5_digest": "3b136deca7762702c178be0a253e6338", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15527, "upload_time": "2017-11-23T08:03:50", "url": "https://files.pythonhosted.org/packages/7d/59/d1e787011cf9b05fcc9c9fb9e29dbb445392c4ed8cf83aebd2290ce12218/ucron-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c4c46e8e5a4c7f71d300e3e101b77a7a", "sha256": "ea0e281c960b28ac68b1b57ce333591db376bc9102144324d7680572396b08c9" }, "downloads": -1, "filename": "ucron-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c4c46e8e5a4c7f71d300e3e101b77a7a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16518, "upload_time": "2018-10-30T12:03:34", "url": "https://files.pythonhosted.org/packages/74/a2/0c064161f4f212cb4b391c22862cfaa7042edbd266f96c20edfc0f98e22f/ucron-0.1.3-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c4c46e8e5a4c7f71d300e3e101b77a7a", "sha256": "ea0e281c960b28ac68b1b57ce333591db376bc9102144324d7680572396b08c9" }, "downloads": -1, "filename": "ucron-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c4c46e8e5a4c7f71d300e3e101b77a7a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 16518, "upload_time": "2018-10-30T12:03:34", "url": "https://files.pythonhosted.org/packages/74/a2/0c064161f4f212cb4b391c22862cfaa7042edbd266f96c20edfc0f98e22f/ucron-0.1.3-py2.py3-none-any.whl" } ] }