{ "info": { "author": "Jos Boumans", "author_email": "jos@krux.com", "bugtrack_url": null, "classifiers": [], "description": "python-krux-scheduler\n=====================\n\nKrux Python class built on top of [Krux Stdlib](https://staticfiles.krxd.net/foss/docs/pypi/krux-stdlib/) for interacting with [APScheduler](http://pythonhosted.org//APScheduler/)\n\nApplication quick start\n-----------------------\n\nThe most common use case for this library is to run a job periodically from a script.\nTo do that, do the following:\n\n```python\n\nimport time\nfrom krux_scheduler import Application\n\ndef main():\n ### The name must be unique to the organization. The object \n ### returned inherits from krux.cli.Application, so it provides\n ### all that functionality as well.\n app = Application( name = 'krux-my-periodic-job' )\n \n ### This is the scheduler object, which behaves exactly \n ### like an APScheduler object, but with logging, stats \n ### and CLI support added.\n scheduler = app.scheduler\n\n ### define the job you want to run periodically\n def periodic_job():\n print 'Called %s at %s' % (app.name, time.asctime())\n\n ### add the periodic job to the scheduler. This follows \n ### APSchedulers arguments & functionality exactly.\n scheduler.add_cron_job(\n func = periodic_job,\n hour = '0,8,16'\n minute = '0',\n )\n\n ### start the scheduler\n scheduler.start()\n\n ### always call app.exit(), so any clean up that needs to\n ### happen can be done at the end of your program. It also\n ### sets the exit code for you appropriately.\n app.exit()\n\n### Run the application stand alone\nif __name__ == '__main__':\n main()\n\n```\n\nSeeing it in action\n-------------------\n\nThis library comes with a CLI tool bundled that shows you how the code works.\nIf you run this, it'll alternate between throwing an exception (which is caught)\nand a simple printed message. \n\nThese are the options and how you can invoke it:\n\n```\n$ krux-scheduler-test -h\nusage: krux-scheduler-test [-h]\n [--log-level {info,debug,critical,warning,error}]\n [--stats] [--stats-host STATS_HOST]\n [--stats-port STATS_PORT]\n [--stats-environment STATS_ENVIRONMENT]\n [--scheduler-minute SCHEDULER_MINUTE]\n [--scheduler-hour SCHEDULER_HOUR]\n [--scheduler-daemonize]\n [--scheduler-exit-after-job]\n\nkrux-scheduler-test\n\noptional arguments:\n -h, --help show this help message and exit\n\nlogging:\n --log-level {info,debug,critical,warning,error}\n Verbosity of logging. (default: warning)\n\nstats:\n --stats Enable sending statistics to statsd. (default: False)\n --stats-host STATS_HOST\n Statsd host to send statistics to. (default:\n localhost)\n --stats-port STATS_PORT\n Statsd port to send statistics to. (default: 8125)\n --stats-environment STATS_ENVIRONMENT\n Statsd environment. (default: dev)\n\nscheduler:\n --scheduler-minute SCHEDULER_MINUTE\n Comma separated list of minute mark(s) to run on. This\n overrides any hardcoded arguments (default: None)\n --scheduler-hour SCHEDULER_HOUR\n Comma separated list of hour mark(s) to run on. This\n overrides any hardcoded arguments (default: None)\n --scheduler-daemonize\n Run scheduled jobs in separate threads (default:\n False)\n --scheduler-exit-after-job\n Exit the application after a job has completed. Very\n useful for RAM hungry applications whose only purpose\n is to run a single job but not otherwise. Requires a\n process monitor to restart if it exits (default:\n False)\n```\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/krux/python-krux-scheduler/tarball/release/0.0.2", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/krux/python-krux-scheduler", "keywords": null, "license": "All Rights Reserved.", "maintainer": null, "maintainer_email": null, "name": "krux-scheduler", "package_url": "https://pypi.org/project/krux-scheduler/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/krux-scheduler/", "project_urls": { "Download": "https://github.com/krux/python-krux-scheduler/tarball/release/0.0.2", "Homepage": "https://github.com/krux/python-krux-scheduler" }, "release_url": "https://pypi.org/project/krux-scheduler/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "Library for interacting with APScheduler built on krux-stdlib", "version": "0.0.2" }, "last_serial": 1227011, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "9fbaf42fb94b3fab0cf8a7f7a2568436", "sha256": "d8dc58e7d5bfce66324862e3918f2aea10c8700b130f9d970e3400388bc503c8" }, "downloads": -1, "filename": "krux-scheduler-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9fbaf42fb94b3fab0cf8a7f7a2568436", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7919, "upload_time": "2014-09-16T00:47:52", "url": "https://files.pythonhosted.org/packages/42/6d/6ce22e087749ab5004dad7c7bf70ac2d0d07c3ad9848ebaa3c6e2e5fe729/krux-scheduler-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9fbaf42fb94b3fab0cf8a7f7a2568436", "sha256": "d8dc58e7d5bfce66324862e3918f2aea10c8700b130f9d970e3400388bc503c8" }, "downloads": -1, "filename": "krux-scheduler-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9fbaf42fb94b3fab0cf8a7f7a2568436", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7919, "upload_time": "2014-09-16T00:47:52", "url": "https://files.pythonhosted.org/packages/42/6d/6ce22e087749ab5004dad7c7bf70ac2d0d07c3ad9848ebaa3c6e2e5fe729/krux-scheduler-0.0.2.tar.gz" } ] }