{ "info": { "author": "Selwin Ong", "author_email": "selwin.ong@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "============\nRQ Scheduler\n============\n\n`RQ Scheduler `_ is a small package that\nadds job scheduling capabilities to `RQ `_,\na `Redis `_ based Python queuing library.\n\n.. image:: https://travis-ci.org/ui/rq-scheduler.svg?branch=master\n :target: https://travis-ci.org/ui/rq-scheduler\n\n============\nRequirements\n============\n\n* `RQ`_\n\n============\nInstallation\n============\n\nYou can install `RQ Scheduler`_ via pip::\n\n pip install rq-scheduler\n\nOr you can download the latest stable package from `PyPI `_.\n\n=====\nUsage\n=====\n\nSchedule a job involves doing two different things:\n\n1. Putting a job in the scheduler\n2. Running a scheduler that will move scheduled jobs into queues when the time comes\n\n----------------\nScheduling a Job\n----------------\n\nThere are two ways you can schedule a job. The first is using RQ Scheduler's ``enqueue_at``::\n\n from redis import Redis\n from rq_scheduler import Scheduler\n from datetime import datetime\n\n scheduler = Scheduler(connection=Redis()) # Get a scheduler for the \"default\" queue\n\n # Puts a job into the scheduler. The API is similar to RQ except that it\n # takes a datetime object as first argument. So for example to schedule a\n # job to run on Jan 1st 2020 we do:\n scheduler.enqueue_at(datetime(2020, 1, 1), func)\n\n # Here's another example scheduling a job to run at a specific date and time (in UTC),\n # complete with args and kwargs.\n scheduler.enqueue_at(datetime(2020, 1, 1, 3, 4), func, foo, bar=baz)\n\n\nThe second way is using ``enqueue_in``. Instead of taking a ``datetime`` object,\nthis method expects a ``timedelta`` and schedules the job to run at\nX seconds/minutes/hours/days/weeks later. For example, if we want to monitor how\npopular a tweet is a few times during the course of the day, we could do something like::\n\n from datetime import timedelta\n\n # Schedule a job to run 10 minutes, 1 hour and 1 day later\n scheduler.enqueue_in(timedelta(minutes=10), count_retweets, tweet_id)\n scheduler.enqueue_in(timedelta(hours=1), count_retweets, tweet_id)\n scheduler.enqueue_in(timedelta(days=1), count_retweets, tweet_id)\n\n\n------------------------\nPeriodic & Repeated Jobs\n------------------------\n\nAs of version 0.3, `RQ Scheduler`_ also supports creating periodic and repeated jobs.\nYou can do this via the ``schedule`` method. Note that this feature needs\n`RQ`_ >= 0.3.1.\n\nThis is how you do it::\n\n scheduler.schedule(\n scheduled_time=datetime.now(), # Time for first execution, in UTC timezone\n func=func, # Function to be queued\n args=[arg1, arg2], # Arguments passed into function when executed\n kwargs={'foo': 'bar'}, # Keyword arguments passed into function when executed\n interval=60, # Time before the function is called again, in seconds\n repeat=10 # Repeat this number of times (None means repeat forever)\n )\n\n-------------------------\nRetrieving scheduled jobs\n-------------------------\n\nSometimes you need to know which jobs have already been scheduled. You can get a\nlist of enqueued jobs with the ``get_jobs`` method::\n\n list_of_job_instances = scheduler.get_jobs()\n\nIn it's simplest form (as seen in the above example) this method returns a list\nof all job instances that are currently scheduled for execution.\n\nAdditionally the method takes two optional keyword arguments ``until`` and\n``with_times``. The first one specifies up to which point in time scheduled jobs\nshould be returned. It can be given as either a datetime / timedelta instance\nor an integer denoting the number of seconds since epoch (1970-01-01 00:00:00).\nThe second argument is a boolen that determines whether the scheduled execution\ntime should be returned along with the job instances.\n\nExample::\n\n # get all jobs until 2012-11-30 10:00:00\n list_of_job_instances = scheduler.get_jobs(until=datetime(2012, 10, 30, 10))\n\n # get all jobs for the next hour\n list_of_job_instances = scheduler.get_jobs(until=timedelta(hours=1))\n\n # get all jobs with execution times\n jobs_and_times = scheduler.get_jobs(with_times=True)\n # returns a list of tuples:\n # [(, datetime.datetime(2012, 11, 25, 12, 30)), ...]\n\n------------------------------\nChecking if a job is scheduled\n------------------------------\n\nYou can check whether a specific job instance or job id is scheduled for\nexecution using the familiar python ``in`` operator::\n\n if job_instance in scheduler:\n # Do something\n # or\n if job_id in scheduler:\n # Do something\n\n---------------\nCanceling a job\n---------------\n\nTo cancel a job, simply do:\n\n scheduler.cancel(job)\n\n---------------------\nRunning the scheduler\n---------------------\n\n`RQ Scheduler`_ comes with a script ``rqscheduler`` that runs a scheduler\nprocess that polls Redis once every minute and move scheduled jobs to the\nrelevant queues when they need to be executed::\n\n # This runs a scheduler process using the default Redis connection\n rqscheduler\n\nIf you want to use a different Redis server you could also do::\n\n rqscheduler --host localhost --port 6379 --db 0\n\nThe script accepts these arguments:\n\n* ``-H`` or ``--host``: Redis server to connect to\n* ``-p`` or ``--port``: port to connect to\n* ``-d`` or ``--db``: Redis db to use\n* ``-P`` or ``--password``: password to connect to Redis\n\nThe arguments pull default values from environment variables with the\nsame names but with a prefix of ``RQ_REDIS_``.\n\n\nChangelog\n=========\n\nVersion 0.5.1\n-------------\n* Travis CI fixes. Thanks Steven Kryskalla!\n* Modified default logging configuration. You can pass in the ``-v`` or ``--verbose`` argument\n to ``rqscheduler`` script for more verbose logging.\n* RQ Scheduler now registers Queue name when a new job is scheduled. Thanks @alejandrodob !\n* You can now schedule jobs with string references like ``scheduler.schedule(scheduled_time=now, func='foo.bar')``.\n Thanks @SirScott !\n* ``rqscheduler`` script now accepts floating point intervals. Thanks Alexander Pikovsky!\n\n\nVersion 0.5.0\n-------------\n* IMPORTANT! Job timestamps are now stored and interpreted in UTC format.\n If you have existing scheduled jobs, you should probably change their timestamp\n to UTC before upgrading to 0.5.0. Thanks @michaelbrooks!\n* You can now configure Redis connection via environment variables. Thanks @malthe!\n* ``rqscheduler`` script now accepts ``--pid`` argument. Thanks @jsoncorwin!\n\nVersion 0.4.0\n-------------\n\n* Supports Python 3!\n* ``Scheduler.schedule`` now allows job ``timeout`` to be specified\n* ``rqscheduler`` allows Redis connection to be specified via ``--url`` argument\n* ``rqscheduler`` now accepts ``--path`` argument\n\nVersion 0.3.6\n-------------\n\n* Scheduler key is not set to expire a few seconds after the next scheduling\n operation. This solves the issue of ``rqscheduler`` refusing to start after\n an unexpected shut down.\n\nVersion 0.3.5\n-------------\n\n* Support ``StrictRedis``\n\n\nVersion 0.3.4\n-------------\n\n* Scheduler related job attributes (``interval`` and ``repeat``) are now stored\n in ``job.meta`` introduced in RQ 0.3.4\n\nVersion 0.3.3\n-------------\n\n* You can now check whether a job is scheduled for execution using\n ``job in scheduler`` syntax\n* Added ``scheduler.get_jobs`` method\n* ``scheduler.enqueue`` and ``scheduler.enqueue_periodic`` will now raise a\n DeprecationWarning, please use ``scheduler.schedule`` instead\n\nVersion 0.3.2\n-------------\n\n* Periodic jobs now require `RQ`_ >= 0.3.1\n\nVersion 0.3\n-----------\n\n* Added the capability to create periodic (cron) and repeated job using ``scheduler.enqueue``\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ui/rq-scheduler", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "rq-scheduler-ng", "package_url": "https://pypi.org/project/rq-scheduler-ng/", "platform": "", "project_url": "https://pypi.org/project/rq-scheduler-ng/", "project_urls": { "Homepage": "https://github.com/ui/rq-scheduler" }, "release_url": "https://pypi.org/project/rq-scheduler-ng/0.5.1/", "requires_dist": null, "requires_python": "", "summary": "Provides job scheduling capabilities to RQ (Redis Queue)", "version": "0.5.1" }, "last_serial": 2561526, "releases": { "0.5.1": [ { "comment_text": "", "digests": { "md5": "eb979a6f767aa2cebf6ffa5a1d736516", "sha256": "ded15d61a14d27834bf1e287e9a2409c6a142c2efaa587aa4e8a496b7bdb0e42" }, "downloads": -1, "filename": "rq_scheduler_ng-0.5.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "eb979a6f767aa2cebf6ffa5a1d736516", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13567, "upload_time": "2017-01-09T03:29:20", "url": "https://files.pythonhosted.org/packages/61/86/515362de1bb55adadcb26507f3cc418348c0e7ee622e431f04a1f694f957/rq_scheduler_ng-0.5.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9548f6cde553d8533425d70623dc0a80", "sha256": "dad4cc8faf775dc1eb2e5ffb18efd79b3b5cc13286c665b54488a21b5e025951" }, "downloads": -1, "filename": "rq-scheduler-ng-0.5.1.tar.gz", "has_sig": false, "md5_digest": "9548f6cde553d8533425d70623dc0a80", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12043, "upload_time": "2017-01-09T03:29:15", "url": "https://files.pythonhosted.org/packages/e0/3e/9fb633898dc786614b47fecb46f29089d88c76b4d08a26f638853ddd5324/rq-scheduler-ng-0.5.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eb979a6f767aa2cebf6ffa5a1d736516", "sha256": "ded15d61a14d27834bf1e287e9a2409c6a142c2efaa587aa4e8a496b7bdb0e42" }, "downloads": -1, "filename": "rq_scheduler_ng-0.5.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "eb979a6f767aa2cebf6ffa5a1d736516", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13567, "upload_time": "2017-01-09T03:29:20", "url": "https://files.pythonhosted.org/packages/61/86/515362de1bb55adadcb26507f3cc418348c0e7ee622e431f04a1f694f957/rq_scheduler_ng-0.5.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9548f6cde553d8533425d70623dc0a80", "sha256": "dad4cc8faf775dc1eb2e5ffb18efd79b3b5cc13286c665b54488a21b5e025951" }, "downloads": -1, "filename": "rq-scheduler-ng-0.5.1.tar.gz", "has_sig": false, "md5_digest": "9548f6cde553d8533425d70623dc0a80", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12043, "upload_time": "2017-01-09T03:29:15", "url": "https://files.pythonhosted.org/packages/e0/3e/9fb633898dc786614b47fecb46f29089d88c76b4d08a26f638853ddd5324/rq-scheduler-ng-0.5.1.tar.gz" } ] }