Async crontab like scheduler
Project description
Introduction
This is an asynchronous job scheduler with crontab syntax.
How to use
Here is a basic example:
# Should run as-is
import time
import asyncio
from typing import Any
from timewheel import TimeWheel
from timewheel.schedule import Schedule
async def my_job():
print("hello from job!")
await asyncio.sleep(3)
async def my_another_job(some_value: Any):
print(f"Hey! This is my some_value {some_value}")
await asyncio.sleep(1)
async def main():
timewheel = TimeWheel(schedules=[
# Runs every 29 minutes using America/Sao_Paulo
# as base
Schedule(name="my-schedule",
expression="*/29 * * * *",
timezone="America/Sao_Paulo",
job=my_job),
# Runs every 5th, 10th and 20th minute on wednesday
# using America/Los_Angeles tz as base
Schedule(name="another-schedule",
expression="5,10,20 * * * 2",
timezone="America/Los_Angeles",
job=my_another_job)])
await timewheel.run()
asyncio.get_event_loop().run_until_complete(main())
The timezone information is based on IANA.
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 Distributions
Close
Hashes for timewheel_scheduler-0.1.1-py3.9.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 003cbca264c549135119fd5aa92216e4ca6dc3e4f3f2b2aa61d4e1d6238d7172 |
|
MD5 | 9844202c8efa339f1d6cb7e430ef83c4 |
|
BLAKE2b-256 | a073a478029596fe9c4fa896e363ce4bb341a4b02b4ac31fd998d7843303a5a4 |
Close
Hashes for timewheel_scheduler-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 521d1349fd6dac36fd81bc3218d182f9830deb005f4070e8e9bd1dff9229ea5a |
|
MD5 | 710a30f471d57704edf2eb7bc4fc3adf |
|
BLAKE2b-256 | a0098e022394afdbbfe22c95c1d2a5ef0db181621b6c2bd296803a67fcb166e1 |