Skip to main content

Simple Scheduler for Python 3.X

Project description

Scheduler

Simple scheduler module

Installation

Only tested on Python 3.X

From source:

$ python setup.py install

For production:

$ pip install job-scheduler

Usage

from datetime import datetime
from datetime import timedelta
from haydn.scheduler import S
from haydn.event_emitter import EventEmitter
import logging

logging.basicConfig(level=logging.DEBUG)


class Example(EventEmitter):

    def __init__(self):
        self.schedule_manager = Scheduler(timer_interval=1)

    def main(self):
        schedule_time = ScheduleTime(start_datetime=datetime.utcnow() + timedelta(seconds=2), end_datetime=datetime.utcnow() + timedelta(seconds=100), repeat=ScheduleTime.REPEAT_SECOND, repeat_interval=5, repeat_limit=5)
        schedule = Schedule(schedule_time, self.do_something, task_params=[1], reference_id=1)

        self.schedule_manager.add_schedule(schedule)
        self.schedule_manager.start()

    def do_something(self, p1):
        print("doing task")
        print("task parameter: ", p1)


example = Example()
example.main()

Project details


Download files

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

Files for job-scheduler, version 0.3.4
Filename, size File type Python version Upload date Hashes
Filename, size job_scheduler-0.3.4-py3.7.egg (8.0 kB) File type Egg Python version 3.7 Upload date Hashes View
Filename, size job-scheduler-0.3.4.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page