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 Python Versions

Requirements

  • python 3.7+

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=False,
    queue_name='donald',
    queue_params={},
)

# 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
donald.submit(corofunction or function, *args, **kwargs)

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

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

# note: queue dont support waiting for results

# ...

# 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)

# ...

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.14.1.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

donald-0.14.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file donald-0.14.1.tar.gz.

File metadata

  • Download URL: donald-0.14.1.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for donald-0.14.1.tar.gz
Algorithm Hash digest
SHA256 655f60afddd3e8e83ae3ef06eae8b8f0c3e6bfd5bf005149d71dd32a0ed2a300
MD5 8a54b2cecf54eab98104e9cfd0de56af
BLAKE2b-256 04aaf424e13b6aa85eb13369f3e03a4cf0e95bf96da21bee41e946238f4f13b9

See more details on using hashes here.

File details

Details for the file donald-0.14.1-py3-none-any.whl.

File metadata

  • Download URL: donald-0.14.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for donald-0.14.1-py3-none-any.whl
Algorithm Hash digest
SHA256 13b26f01720410f9546a3bc5506ece01406fb4c4ab1f265deac619f9daaf8365
MD5 e3db195faca3117d2efbd788c31be117
BLAKE2b-256 74b76e684ed215d09b9f070a301fed07d1c329606097e1ed62089d85323e5c5d

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