urd


Nameurd JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/boxed/urd
SummaryUrd is a scheduler for Django projects
upload_time2023-11-21 10:11:06
maintainer
docs_urlNone
authorAnders Hovmöller
requires_python
licenseBSD
keywords urd
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Urd
---

Urd is a scheduler for Django projects. Some features:

- schedule < 1m time slots
- single concurrent execution [#single]_
- fast enable/disable [#fastdisable]_
- simple deployment
- no extra dependencies beyond Django

.. [#single]

    If tasks take longer to execute than the time to the next execution slot, you get a warning on the next execution. But not simultaneous execution or wild buildup of queues. There is no queue.

.. [#fastdisable]

    It's vitally important to be able to stop a runaway process. With the ``heartbeat``, and with the worker reading the database state before executing, it's easy and fast to disable a job.


Setup
=====

- Install urd ``pip install urd``
- Add ``urd`` to ``INSTALLED_APPS``
- Run ``manage.py migrate``
- Start the scheduler with ``manage.py monitor``


Usage
=====

- Define a ``tasks.py`` module in the app that should have tasks.
- Create a function like this:

.. code-block:: python

    @schedulable_task
    def my_task(heartbeat):
        for foo in bar:
            heartbeat()
            do_some_task()


Calling ``heartbeat()`` regularly is important to make the task cancellable in a timely manner.

Now define a task in the iommi admin. It will be enabled pretty much as soon as you save.


Administration
==============

Urd ships with integration for the `iommi <https://docs.iommi.rocks>`_ admin.


Why not cron/celery/django-q
============================

- Cron didn't work for me because I need to execute a function more often than once a minute
- Cron also doesn't work for me because if you do once per minute, and the task takes two minutes, you get TWO executing processes of that task for a while. This can be disastrous for a few reasons, and can cause things to spiral out of control.
- Celery/django-q are task queues, not schedulers. They have scheduler components, but they don't have a way to ensure only one process at a time runs a specific task.
- Django-q doesn't allow schedules that execute more often than once per minute
- Django-q caused me a lot of problems where the schedule seemed to put future items in the queue, and I couldn't make it stop trying to execute them.


What does urd mean?
===================

Urd (or Urðr, or Wyrd) is one of the Norns, the goddesses who weave the destiny of gods and humans.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/boxed/urd",
    "name": "urd",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "urd",
    "author": "Anders Hovm\u00f6ller",
    "author_email": "boxed@killingar.net",
    "download_url": "https://files.pythonhosted.org/packages/cb/5d/45f0cacfaf8468ebb54cde706757b4b0395b824e661901b23bff6966dfcb/urd-1.3.0.tar.gz",
    "platform": null,
    "description": "Urd\n---\n\nUrd is a scheduler for Django projects. Some features:\n\n- schedule < 1m time slots\n- single concurrent execution [#single]_\n- fast enable/disable [#fastdisable]_\n- simple deployment\n- no extra dependencies beyond Django\n\n.. [#single]\n\n    If tasks take longer to execute than the time to the next execution slot, you get a warning on the next execution. But not simultaneous execution or wild buildup of queues. There is no queue.\n\n.. [#fastdisable]\n\n    It's vitally important to be able to stop a runaway process. With the ``heartbeat``, and with the worker reading the database state before executing, it's easy and fast to disable a job.\n\n\nSetup\n=====\n\n- Install urd ``pip install urd``\n- Add ``urd`` to ``INSTALLED_APPS``\n- Run ``manage.py migrate``\n- Start the scheduler with ``manage.py monitor``\n\n\nUsage\n=====\n\n- Define a ``tasks.py`` module in the app that should have tasks.\n- Create a function like this:\n\n.. code-block:: python\n\n    @schedulable_task\n    def my_task(heartbeat):\n        for foo in bar:\n            heartbeat()\n            do_some_task()\n\n\nCalling ``heartbeat()`` regularly is important to make the task cancellable in a timely manner.\n\nNow define a task in the iommi admin. It will be enabled pretty much as soon as you save.\n\n\nAdministration\n==============\n\nUrd ships with integration for the `iommi <https://docs.iommi.rocks>`_ admin.\n\n\nWhy not cron/celery/django-q\n============================\n\n- Cron didn't work for me because I need to execute a function more often than once a minute\n- Cron also doesn't work for me because if you do once per minute, and the task takes two minutes, you get TWO executing processes of that task for a while. This can be disastrous for a few reasons, and can cause things to spiral out of control.\n- Celery/django-q are task queues, not schedulers. They have scheduler components, but they don't have a way to ensure only one process at a time runs a specific task.\n- Django-q doesn't allow schedules that execute more often than once per minute\n- Django-q caused me a lot of problems where the schedule seemed to put future items in the queue, and I couldn't make it stop trying to execute them.\n\n\nWhat does urd mean?\n===================\n\nUrd (or Ur\u00f0r, or Wyrd) is one of the Norns, the goddesses who weave the destiny of gods and humans.\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Urd is a scheduler for Django projects",
    "version": "1.3.0",
    "project_urls": {
        "Homepage": "https://github.com/boxed/urd"
    },
    "split_keywords": [
        "urd"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4e4e85d107a9d8f048faa376251208fd79690b2406f4328d60a0dbedf41a9150",
                "md5": "07910151cbc1eb68f0e2368e27fe5ad0",
                "sha256": "3b11dbda681784a6dfd88b54a33a825a8e4db87dae06e5d8d982b7f7d16e46b5"
            },
            "downloads": -1,
            "filename": "urd-1.3.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "07910151cbc1eb68f0e2368e27fe5ad0",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 16879,
            "upload_time": "2023-11-21T10:11:05",
            "upload_time_iso_8601": "2023-11-21T10:11:05.253639Z",
            "url": "https://files.pythonhosted.org/packages/4e/4e/85d107a9d8f048faa376251208fd79690b2406f4328d60a0dbedf41a9150/urd-1.3.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb5d45f0cacfaf8468ebb54cde706757b4b0395b824e661901b23bff6966dfcb",
                "md5": "88dc51ba9dbe3441c9d80b995c477fa9",
                "sha256": "e139b3daaef90c24a8df677dca9ba2e560fd9148bd3c997fa051f98a387cb383"
            },
            "downloads": -1,
            "filename": "urd-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "88dc51ba9dbe3441c9d80b995c477fa9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14106,
            "upload_time": "2023-11-21T10:11:06",
            "upload_time_iso_8601": "2023-11-21T10:11:06.569066Z",
            "url": "https://files.pythonhosted.org/packages/cb/5d/45f0cacfaf8468ebb54cde706757b4b0395b824e661901b23bff6966dfcb/urd-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-21 10:11:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "boxed",
    "github_project": "urd",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "urd"
}
        
Elapsed time: 0.15453s