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.

Source Distribution

job-scheduler-0.3.4.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

job_scheduler-0.3.4-py3.7.egg (8.0 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