Skip to main content

Simple asynchronous task helpers

Project description

async_task_helpers

Simple asynchronous task helpers

How to install

pip install async_task_helpers

Features

Loop tasks

from async_task_helpers import loop

@loop(minutes=5, seconds=30)
async def loop_example():
    # This LoopTask will run in every 5 minute and 30 seconds.
    await some_async_task()
    await some_async_task2()

Asynchronous Callbacks

import asyncio
from async_task_helpers import async_callback_handler

async def universe_last_answer():
    print('Universe`s a whole and entire, final answer is...')
    await asyncio.sleep(1)
    print('42!')
    return 42


async def async_callback(result):
    await asyncio.sleep(5)
    print(f'I got the result of {result}!')
    

task = asyncio.create_task(
    async_callback_handler(
        universe_last_answer,
        async_callback
    ),
    name='Async Callback Test'
)

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

async_task_helpers-1.0.0-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

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