Skip to main content

Python task scheduling with cron expression

Project description

A simple job scheduler with cron expression

Inspired by “schedule”.

Usage

$ pip3 install scheduler-cron
import scheduler

def test_1():
    print('test1')

def test_2(name):
    print('test2: ' + name)

def test_3(name, lname):
    print('test3: ' + name + ' ' + lname)

scheduler = Scheduler(60)
scheduler.add('foo', '* * * * *', test_1)
scheduler.add('bar', '0/2 * * * *', test_2, ('mehrdad',))
scheduler.add('bas', '0/3 * * * *', test_3, ('behzad', 'mahmoudi'))
scheduler.add('zoo', '0/4 * * * *', test_3, ('reza', 'mahmoudi'))
scheduler.start()

ToDo

  • Run jobs in async mode

  • sleep for more than interval seconds if there is no jobs for next run

Meta

Mehrdad Mahmoudi - @mehrdadmhd - mehrdadmhd@gmail.com

https://github.com/mehrdadmhd/scheduler-py

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

scheduler-cron-0.1.tar.gz (2.2 kB view hashes)

Uploaded Source

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