Skip to main content

asyncio crontab utils

Project description

async_cron

Downloads PyPI version

this repo is influenced by schedule.

we supply a async scheduler and async function support

you can easily integrate this lib to you async program,with no blocking

Install


pip install async_cron

Usage examples


All you need is a loop, then enjoy. you can refer to examples, as well.

Consumer:

import asyncio

from async_cron.job import CronJob
from async_cron.schedule import Scheduler


async def test(*args, **kwargs):
    print(args, kwargs)


def tt(*args, **kwargs):
    print(args, kwargs)


msh = Scheduler()
myjob = CronJob(name='test').every(5).second.go(test, (1, 2, 3), name=123)
# tolerance means if now - at_exact_time <= tolerance,this job will still be applied
job2 = CronJob(name='tt', tolerance=100).at(
    "2019-01-15 16:12").go(tt, (5), age=99)

# msh.add_job(myjob)
msh.add_job(job2)


loop = asyncio.get_event_loop()

loop.run_until_complete(msh.start())

License

The async_cron is offered under MIT license.

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_cron-1.0.0-py3-none-any.whl (4.8 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