All Projects → gawel → Aiocron

gawel / Aiocron

Licence: mit
Crontabs for asyncio

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Aiocron

Yacron
A modern Cron replacement that is Docker-friendly
Stars: ✭ 302 (+85.28%)
Mutual labels:  asyncio, cron
Importexportfree
Improve default Magento 2 Import / Export features - cron jobs, CSV , XML , JSON , Excel , mapping of any format, Google Sheet, data and price modification, improved speed and a lot more!
Stars: ✭ 160 (-1.84%)
Mutual labels:  cron
Quantum Core
⌚ Cron-like job scheduler for Elixir
Stars: ✭ 1,905 (+1068.71%)
Mutual labels:  cron
Ignareo Isml Auto Voter
Ignareo the Carillon, a web spider template of ultimate concurrency built for leprechauns. Carillons as the best web spiders; Long live the golden years of leprechauns!
Stars: ✭ 154 (-5.52%)
Mutual labels:  asyncio
Python Simple Rest Client
Simple REST client for python 3.6+
Stars: ✭ 143 (-12.27%)
Mutual labels:  asyncio
Factotum
A system to programmatically run data pipelines
Stars: ✭ 158 (-3.07%)
Mutual labels:  cron
Ext Zookeeper
🧑 Coroutine-based ZooKeeper Client for PHP
Stars: ✭ 140 (-14.11%)
Mutual labels:  asyncio
Fastapi Crudrouter
A dynamic FastAPI router that automatically creates CRUD routes for your models
Stars: ✭ 159 (-2.45%)
Mutual labels:  asyncio
Aiozipkin
Distributed tracing instrumentation for asyncio with zipkin
Stars: ✭ 161 (-1.23%)
Mutual labels:  asyncio
Heliocron
A command line application written in Rust capable of delaying execution of other programs for time periods relative to sunrise and sunset.
Stars: ✭ 152 (-6.75%)
Mutual labels:  cron
Tortoise Orm
Familiar asyncio ORM for python, built with relations in mind
Stars: ✭ 2,558 (+1469.33%)
Mutual labels:  asyncio
Cronos
A PHP component for updating crontab
Stars: ✭ 145 (-11.04%)
Mutual labels:  cron
Switchio
asyncio powered FreeSWITCH cluster control
Stars: ✭ 160 (-1.84%)
Mutual labels:  asyncio
Hangups
the first third-party instant messaging client for Google Hangouts
Stars: ✭ 1,739 (+966.87%)
Mutual labels:  asyncio
Saffron
The cron parser powering Cron Triggers on Cloudflare Workers
Stars: ✭ 161 (-1.23%)
Mutual labels:  cron
Aioinflux
Asynchronous Python client for InfluxDB
Stars: ✭ 142 (-12.88%)
Mutual labels:  asyncio
Pyserial Asyncio
asyncio extension package for pyserial
Stars: ✭ 150 (-7.98%)
Mutual labels:  asyncio
Pulsar
Event driven concurrent framework for Python
Stars: ✭ 1,867 (+1045.4%)
Mutual labels:  asyncio
Xk Time
xk-time 是时间转换,时间计算,时间格式化,时间解析,日历,时间cron表达式和时间NLP等的工具,使用Java8,线程安全,简单易用,多达70几种常用日期格式化模板,支持Java8时间类和Date,轻量级,无第三方依赖。
Stars: ✭ 162 (-0.61%)
Mutual labels:  cron
Aiocqhttp
A Python SDK with async I/O for CQHTTP.
Stars: ✭ 162 (-0.61%)
Mutual labels:  asyncio

================================================ aiocron - Crontabs for asyncio

.. image:: https://travis-ci.org/gawel/aiocron.svg?branch=master :target: https://travis-ci.org/gawel/aiocron .. image:: https://img.shields.io/pypi/v/aiocron.svg :target: https://pypi.python.org/pypi/aiocron .. image:: https://img.shields.io/pypi/dm/aiocron.svg :target: https://pypi.python.org/pypi/aiocron

Usage

aiocron provide a decorator to run function at time::

>>> import aiocron
>>> import asyncio
>>>
>>> @aiocron.crontab('*/30 * * * *')
... async def attime():
...     print('run')
...
>>> asyncio.get_event_loop().run_forever()

You can also use it as an object::

>>> @aiocron.crontab('1 9 * * 1-5', start=False)
... async def attime():
...     print('run')
...
>>> attime.start()
>>> asyncio.get_event_loop().run_forever()

Your function still be available at attime.func

You can also await a crontab. In this case, your coroutine can accept arguments::

>>> @aiocron.crontab('0 9,10 * * * mon,fri', start=False)
... async def attime(i):
...     print('run %i' % i)
...
>>> async def once():
...     try:
...         res = await attime.next(1)
...     except Exception as e:
...         print('It failed (%r)' % e)
...     else:
...         print(res)
...
>>> asyncio.get_event_loop().run_forever()

Finally you can use it as a sleep coroutine. The following will wait until next hour::

>>> await crontab('0 * * * *').next()

If you don't like the decorator magic you can set the function by yourself::

>>> cron = crontab('0 * * * *', func=yourcoroutine, start=False)

Notice that unlike standard unix crontab you can specify seconds at the 6th position.

aiocron use croniter <https://pypi.python.org/pypi/croniter>_. Refer to it's documentation to know more about crontab format.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].