Donald


NameDonald JSON
Version 0.4.4 PyPI version JSON
download
home_pagehttps://github.com/klen/donald
SummaryDonald is here
upload_time2020-12-17 14:35:52
maintainer
docs_urlNone
authorKirill Klenov
requires_python
licenseBSD
keywords asyncio tasks queue
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Donald
######

.. _description:

Donald -- A simple task engine for Asyncio.

The main goal for Donald to run async/sync code without blocking main loop.

Donald supports synchronous and asynchronous paradigms. The package is running
coroutines and functions in multi loops. Donald could run periodic tasks and
listen AMQP queues.

.. _badges:

.. image:: https://github.com/klen/donald/workflows/tests/badge.svg
    :target: https://github.com/klen/donald/actions
    :alt: Tests Status

.. image:: https://img.shields.io/pypi/v/donald
    :target: https://pypi.org/project/donald/
    :alt: PYPI Version

.. _contents:

.. contents::

.. _requirements:

Requirements
=============

- python 3.8+

.. _installation:

Installation
=============

**Donald** should be installed using pip: ::

    pip install donald

.. _usage:

Usage
=====

From shell: ::

    $ donald --help


From asynchronous python code:

.. code:: python

    # Init Donald
    donald = Donald(
        # Params (default values)
        # -----------------------

        # Run tasks imediatelly in the same process/thread
        fake_mode=False,

        # Number of workers
        num_workers=multiprocessing.cpu_count() - 1,

        # Maximum concurent tasks per worker
        max_tasks_per_worker=100,

        # Ensure that the Donald starts only once (set to filename to lock)
        filelock=None,

        # logging level
        loglevel='INFO',

        # AMQP params
        queue={
            'exchange': 'donald',
            'queue': 'donald',
        }
    )

    # Schedule periodic tasks
    @donald.schedule(crontab_string | seconds_float | datetime_timedelta, *args, **kwargs)
    async def task(*args, **kwargs):
        # ...

    # Start the donald
    await donald.start()

    # ...

    # Submit a task to donald
    await donald.submit(corofunction or function, *args, **kwargs)

    # Submit and wait for result
    result = await donald.submit(corofunction or function, *args, **kwargs)

    # ...

    # Stop the donald
    await donald.stop()

Connect and receive tasks using AMQP
------------------------------------

.. code:: python

    donald = Donald()

    await donald.start()
    await donald.queue.start()

    # ...


    # Stop the donald
    await donald.queue.stop()
    await donald.stop()

Submit tasks to AMQP
--------------------

.. code::

    # Send task to queue
    await donald.queue.submit(<coro or func>, *args, **kwargs)

    # ...

    # Listen tasks
    await donald.queue.listen()
    await donald.listen(<AMQP URL>)


.. _bugtracker:

Bug tracker
===========

If you have any suggestions, bug reports or
annoyances please report them to the issue tracker
at https://github.com/klen/donald/issues

.. _contributing:

Contributing
============

Development of starter happens at github: https://github.com/klen/donald


Contributors
=============

* klen_ (Kirill Klenov)

.. _license:

License
========

Licensed under a `BSD license`_.

.. _links:

.. _BSD license: http://www.linfo.org/bsdlicense.html
.. _klen: https://klen.github.io/
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/klen/donald",
    "name": "Donald",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "asyncio,tasks,queue",
    "author": "Kirill Klenov",
    "author_email": "horneds@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/41/8f/4df663c1677604748593d305d74c6a623dad119f19589f8d88c2852e4c3b/Donald-0.4.4.tar.gz",
    "platform": "Any",
    "description": "Donald\n######\n\n.. _description:\n\nDonald -- A simple task engine for Asyncio.\n\nThe main goal for Donald to run async/sync code without blocking main loop.\n\nDonald supports synchronous and asynchronous paradigms. The package is running\ncoroutines and functions in multi loops. Donald could run periodic tasks and\nlisten AMQP queues.\n\n.. _badges:\n\n.. image:: https://github.com/klen/donald/workflows/tests/badge.svg\n    :target: https://github.com/klen/donald/actions\n    :alt: Tests Status\n\n.. image:: https://img.shields.io/pypi/v/donald\n    :target: https://pypi.org/project/donald/\n    :alt: PYPI Version\n\n.. _contents:\n\n.. contents::\n\n.. _requirements:\n\nRequirements\n=============\n\n- python 3.8+\n\n.. _installation:\n\nInstallation\n=============\n\n**Donald** should be installed using pip: ::\n\n    pip install donald\n\n.. _usage:\n\nUsage\n=====\n\nFrom shell: ::\n\n    $ donald --help\n\n\nFrom asynchronous python code:\n\n.. code:: python\n\n    # Init Donald\n    donald = Donald(\n        # Params (default values)\n        # -----------------------\n\n        # Run tasks imediatelly in the same process/thread\n        fake_mode=False,\n\n        # Number of workers\n        num_workers=multiprocessing.cpu_count() - 1,\n\n        # Maximum concurent tasks per worker\n        max_tasks_per_worker=100,\n\n        # Ensure that the Donald starts only once (set to filename to lock)\n        filelock=None,\n\n        # logging level\n        loglevel='INFO',\n\n        # AMQP params\n        queue={\n            'exchange': 'donald',\n            'queue': 'donald',\n        }\n    )\n\n    # Schedule periodic tasks\n    @donald.schedule(crontab_string | seconds_float | datetime_timedelta, *args, **kwargs)\n    async def task(*args, **kwargs):\n        # ...\n\n    # Start the donald\n    await donald.start()\n\n    # ...\n\n    # Submit a task to donald\n    await donald.submit(corofunction or function, *args, **kwargs)\n\n    # Submit and wait for result\n    result = await donald.submit(corofunction or function, *args, **kwargs)\n\n    # ...\n\n    # Stop the donald\n    await donald.stop()\n\nConnect and receive tasks using AMQP\n------------------------------------\n\n.. code:: python\n\n    donald = Donald()\n\n    await donald.start()\n    await donald.queue.start()\n\n    # ...\n\n\n    # Stop the donald\n    await donald.queue.stop()\n    await donald.stop()\n\nSubmit tasks to AMQP\n--------------------\n\n.. code::\n\n    # Send task to queue\n    await donald.queue.submit(<coro or func>, *args, **kwargs)\n\n    # ...\n\n    # Listen tasks\n    await donald.queue.listen()\n    await donald.listen(<AMQP URL>)\n\n\n.. _bugtracker:\n\nBug tracker\n===========\n\nIf you have any suggestions, bug reports or\nannoyances please report them to the issue tracker\nat https://github.com/klen/donald/issues\n\n.. _contributing:\n\nContributing\n============\n\nDevelopment of starter happens at github: https://github.com/klen/donald\n\n\nContributors\n=============\n\n* klen_ (Kirill Klenov)\n\n.. _license:\n\nLicense\n========\n\nLicensed under a `BSD license`_.\n\n.. _links:\n\n.. _BSD license: http://www.linfo.org/bsdlicense.html\n.. _klen: https://klen.github.io/",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Donald is here",
    "version": "0.4.4",
    "split_keywords": [
        "asyncio",
        "tasks",
        "queue"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "2813b9921395796515c1135424ef91e5",
                "sha256": "680a4fee52f70878d23779812e8e1f79f78fd43e98082010d18c77b7cb96c56f"
            },
            "downloads": -1,
            "filename": "Donald-0.4.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2813b9921395796515c1135424ef91e5",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 10143,
            "upload_time": "2020-12-17T14:35:55",
            "upload_time_iso_8601": "2020-12-17T14:35:55.726501Z",
            "url": "https://files.pythonhosted.org/packages/c0/5e/e7492f736b2890e8e71fbd881fde9a55d7ce8091cc710e72cda23d851cd0/Donald-0.4.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "4ac5356dd04c49aed0b1894269b013ed",
                "sha256": "5aa1c570e98bb4ed47aa011f61e78dad84441332ced509f0630207b6e609c977"
            },
            "downloads": -1,
            "filename": "Donald-0.4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "4ac5356dd04c49aed0b1894269b013ed",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9033,
            "upload_time": "2020-12-17T14:35:52",
            "upload_time_iso_8601": "2020-12-17T14:35:52.548432Z",
            "url": "https://files.pythonhosted.org/packages/41/8f/4df663c1677604748593d305d74c6a623dad119f19589f8d88c2852e4c3b/Donald-0.4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-12-17 14:35:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "klen",
    "error": "Could not fetch GitHub repository",
    "lcname": "donald"
}
        
Elapsed time: 0.17931s