usunyu / async-schedule

Python job scheduling for humans with async support.

Home Page:https://schedule.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

schedule

https://coveralls.io/repos/dbader/schedule/badge.svg?branch=master

Python job scheduling for humans. Run Python functions (or any other callable) periodically using a friendly syntax.

  • A simple to use API for scheduling jobs, made for humans.
  • In-process scheduler for periodic jobs. No extra processes needed!
  • Very lightweight and no external dependencies.
  • Excellent test coverage.
  • Tested on Python and 3.6, 3.7, 3.8, 3.9

Usage

$ mkdir schedule
$ cd schedule
$ curl -L https://codeload.github.com/usunyu/async-schedule/tar.gz/master | tar -xz --strip=2 async-schedule-master/schedule
import asyncio
from schedule import async_schedule

async def job():
    await asyncio.sleep(1.0)
    print("I'm working...")

async_schedule.every(10).seconds.do(job)
async_schedule.every(10).minutes.do(job)
async_schedule.every().hour.do(job)
async_schedule.every().day.at("10:30").do(job)
async_schedule.every(5).to(10).minutes.do(job)
async_schedule.every().monday.do(job)
async_schedule.every().wednesday.at("13:15").do(job)
async_schedule.every().day.at("12:42", "Europe/Amsterdam").do(job)
async_schedule.every().minute.at(":17").do(job)

async def job_with_argument(name):
    await asyncio.sleep(1.0)
    print(f"I am {name}")

async_schedule.every(10).seconds.do(job_with_argument, name="Peter")

async def main():
    while True:
        await async_schedule.run_pending()
        await asyncio.sleep(1.0)

asyncio.run(main())

Documentation

Schedule's documentation lives at schedule.readthedocs.io.

Meta

Daniel Bader - @dbader_org - mail@dbader.org

Inspired by Adam Wiggins' article "Rethinking Cron" and the clockwork Ruby module.

Distributed under the MIT license. See LICENSE.txt for more information.

https://github.com/dbader/schedule

About

Python job scheduling for humans with async support.

https://schedule.readthedocs.io/

License:MIT License


Languages

Language:Python 100.0%