Skip to main content

Donald is here

Project 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.

Tests Status PYPI Version

Requirements

  • python 3.8+

Installation

Donald should be installed using pip:

pip install donald

Usage

From shell:

$ donald --help

From asynchronous python code:

# 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',
    }
)

# Start the donald
await donald.start()

# ...

result = await donald.submit(corofunction or function, *args, **kwargs)
await donald.schedule(crontab_string | seconds_float | datetime_timedelta, corofunction or function, *args, **kwargs)

# ...

# Stop the donald
await donald.stop()

Connect and receive tasks using AMQP

donald = Donald()

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

# ...


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

Submit tasks to AMQP

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

# ...

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

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

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

Contributors

  • klen (Kirill Klenov)

License

Licensed under a BSD license.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Donald-0.3.3.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

Donald-0.3.3-py2.py3-none-any.whl (9.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file Donald-0.3.3.tar.gz.

File metadata

  • Download URL: Donald-0.3.3.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for Donald-0.3.3.tar.gz
Algorithm Hash digest
SHA256 e0404b1c926e48d53a0f0fe5b3676be062d0683839265e657a5eef49e54f8342
MD5 2d5807b4d8e51fbfddd868dea57ce149
BLAKE2b-256 754ee8503b6e98796d5199eec3d6cb9c9d723fb11c98e785b1268eb94133e3b9

See more details on using hashes here.

File details

Details for the file Donald-0.3.3-py2.py3-none-any.whl.

File metadata

  • Download URL: Donald-0.3.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.0

File hashes

Hashes for Donald-0.3.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e1a146d1648f3b30ffafcd85091e00fdc1d0ce7a2db7ff31af87b973cbf97200
MD5 c33f9a7057ab4e2000ab434703da8813
BLAKE2b-256 b78a986e8f3b09bf6f7f6476c647cfa33216ed325f2f725c358126a04911c5f8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page