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 details)

Uploaded Source

File details

Details for the file scheduler-cron-0.1.tar.gz.

File metadata

  • Download URL: scheduler-cron-0.1.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for scheduler-cron-0.1.tar.gz
Algorithm Hash digest
SHA256 ea6307fdbc3cd47ae489a544aa834d53f0fa001eae6de416b95ffd4f2f265f77
MD5 dfb3c29fa4426d5cf71f962659f14f44
BLAKE2b-256 2db0d23c370be8de10f3b14f003a67a0cb447a84ff8ef083660d612529ec5e89

See more details on using hashes here.

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