{ "info": { "author": "Pham Cong Dinh", "author_email": "pcdinh@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "GreenClock\n==========\n\n[![Travs-CI status](https://travis-ci.org/pcdinh/greenclock.png)](https://travis-ci.org/pcdinh/greenclock) \n\nGreenClock is a time-based task scheduler using gevent\n\nWith GreenClock, you can: Schedule a task to run every X seconds, daily, weekly, monthly, \nor at certain times (such as application startup).\n\nGreenClock launches a [green thread](http://en.wikipedia.org/wiki/Green_threads) per task.\nTherefore every task will be executed in a concurrent manner, without blocking each other.\n\n### Status\n\nThis module is currently under development.\n\n### Features\n\n - A simple to use API for scheduling jobs.\n - Lightweight (depending on gevent only)\n - Works with Python 2.7+\n - Support the following scheduling scenarios: \n + run every X seconds\n + run every hour at specified minute and second\n + run at specified time (hour:minute:second) every day\n + more to come\n\n### Installation\n\nThis library depends on gevent 1.0 RC2\n\n```bash\n $ pip install cython -e git://github.com/surfly/gevent.git@1.0rc2#egg=gevent\n```\n\nTo install GreenClock from [pip](https://pypi.python.org/pypi/pip):\n\n```bash\n $ pip install greenclock\n```\n\n\nYou can also install it into your Python application directory\n\n```bash\n $ pip install --install-option=\"--prefix=/path/to/python/app\" greenclock\n```\n\n\nTo install GreenClock from source:\n```bash\n $ git clone git@github.com:pcdinh/greenclock.git\n $ python setup.py install\n```\n\n### Usage\n\n```\n\nimport greenclock\nfrom datetime import datetime\nimport time\n\ndef func_1():\n print('Calling func_1() at ' + str(datetime.now()))\n time.sleep(2)\n print('Ended call to func_1() at ' + str(datetime.now()))\n\ndef func_2():\n print('Calling func_2() at ' + str(datetime.now()))\n time.sleep(2)\n print('Ended call to func_2() at ' + str(datetime.now()))\n\nif __name__ == \"__main__\":\n scheduler = greenclock.Scheduler(logger_name='task_scheduler')\n scheduler.schedule('task_1', greenclock.every_second(4), func_1)\n scheduler.schedule('task_2', greenclock.every_second(1), func_2)\n # Run hourly task at 41:00 every day\n scheduler.schedule('task_3', greenclock.every_hour(minute=41, second=0), func_3)\n # Run daily task at 12:35:00\n scheduler.schedule('task_2', greenclock.every_hour(hour=12, minute=35, second=0), func_2) \n # To start the scheduled tasks immediately, specify 'once' for `start_at`\n # Other values: \n # * `next_minute`: Wait until the first seconds of the next minute to run\n # * `next_hour`: Wait until the first seconds of the next hour to run\n # * `tomorrow`: Wait until the first seconds of tomorrow to run\n scheduler.run_forever(start_at='once')\n\n```\n\nBasically to schedule a periodic task or job, you need to specify the following parameters:\n\n + Task name: `task_1`\n + A timer that let the scheduler know how to run a periodic task\n\n``` \n # run the task for every 4 seconds\n greenclock.every_second(4) \n # run the task every day at 01:10:00\n greenclock.every_hour(hour=1, minute=10, second=0)\n``` \n + A function or callable object\n + Optional parameters to the above function or callable object\n``` \n scheduler.schedule('task_1', greenclock.every_second(1), func_1, param1, param2, named_param=2)\n``` \n`Scheduler` object can run a separate process which never exits if you want it to\n```\n scheduler.run_forever(start_at='once')\n```", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/pcdinh/greenclock/tarball/0.2.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pcdinh/greenclock", "keywords": "cron,scheduling,schedule,periodic,jobs,clockwork,gevent", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "greenclock", "package_url": "https://pypi.org/project/greenclock/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/greenclock/", "project_urls": { "Download": "https://github.com/pcdinh/greenclock/tarball/0.2.1", "Homepage": "https://github.com/pcdinh/greenclock" }, "release_url": "https://pypi.org/project/greenclock/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "A library that provides time-based task scheduling using green threads via gevent.", "version": "0.2.1" }, "last_serial": 837489, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1003b192c6554415b2d194d439398200", "sha256": "85747f2f59eb8aabc77f7db0ba5f1a5d89dad58eeff5f618fe0884acae33f15f" }, "downloads": -1, "filename": "greenclock-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1003b192c6554415b2d194d439398200", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2888, "upload_time": "2013-08-10T09:11:38", "url": "https://files.pythonhosted.org/packages/d7/a0/42163aae0049b759d9959755c40b816075576823b6450a3ce7842c5e17d6/greenclock-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "9545e62600534492abc543b589c67c40", "sha256": "8ce31783216e1d763ed4ff2b6a074f6a73370fbb3154587ec275bced1142732f" }, "downloads": -1, "filename": "greenclock-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9545e62600534492abc543b589c67c40", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3004, "upload_time": "2013-08-10T09:33:08", "url": "https://files.pythonhosted.org/packages/e7/78/e4b4c55494b83a3715f147e7febe67b9619bfb7ab57e4adb563385cf5447/greenclock-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "16241295dcad933ecef41dad51203255", "sha256": "2918b6ffa91de6826682057cb9641fc0e189b4a56eac5ae62ae54275eac633f5" }, "downloads": -1, "filename": "greenclock-0.1.2.tar.gz", "has_sig": false, "md5_digest": "16241295dcad933ecef41dad51203255", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3997, "upload_time": "2013-08-10T11:11:40", "url": "https://files.pythonhosted.org/packages/41/63/4629f6b151fea26ed1d992d4f4aac728b13a88fed50eabf28fb9f64822e1/greenclock-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "ee3b267fc2689b86db6216a4277d3672", "sha256": "610a809046051d8d7558862bd0ce8200ce7e2f69ab2c25541eb39dde5f721936" }, "downloads": -1, "filename": "greenclock-0.1.3.tar.gz", "has_sig": false, "md5_digest": "ee3b267fc2689b86db6216a4277d3672", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4155, "upload_time": "2013-08-10T13:20:03", "url": "https://files.pythonhosted.org/packages/7f/ca/df24dc465878a3480248d8268e34b3135643d43620008962d23efdc25883/greenclock-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "3f465cf2bb29f2a90cb0b97ab8148c44", "sha256": "db472875f780e533c87ed91b1813905a7bd508e6e94995f848ddba5c198c2707" }, "downloads": -1, "filename": "greenclock-0.2.0.tar.gz", "has_sig": false, "md5_digest": "3f465cf2bb29f2a90cb0b97ab8148c44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5075, "upload_time": "2013-08-11T06:33:10", "url": "https://files.pythonhosted.org/packages/22/9e/e1864d2416e864ea55fa4e88f8c4817ccafaa63e31457b1de20a24ac0f4f/greenclock-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "1fc5e9c90a54542171c2acf768114867", "sha256": "0aaa137ce3cae21953a8161d1757834335f26fc622d1a2498b320c09427fda30" }, "downloads": -1, "filename": "greenclock-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1fc5e9c90a54542171c2acf768114867", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5692, "upload_time": "2013-08-11T09:32:52", "url": "https://files.pythonhosted.org/packages/98/85/3398945b7ef560b054882598f41d1d0fcdec44374de265fe3b40da137a8c/greenclock-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1fc5e9c90a54542171c2acf768114867", "sha256": "0aaa137ce3cae21953a8161d1757834335f26fc622d1a2498b320c09427fda30" }, "downloads": -1, "filename": "greenclock-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1fc5e9c90a54542171c2acf768114867", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5692, "upload_time": "2013-08-11T09:32:52", "url": "https://files.pythonhosted.org/packages/98/85/3398945b7ef560b054882598f41d1d0fcdec44374de265fe3b40da137a8c/greenclock-0.2.1.tar.gz" } ] }