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

Uploaded Source

Built Distribution

job_scheduler-0.3.4-py3.7.egg (8.0 kB view details)

Uploaded Source

File details

Details for the file job-scheduler-0.3.4.tar.gz.

File metadata

  • Download URL: job-scheduler-0.3.4.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.2

File hashes

Hashes for job-scheduler-0.3.4.tar.gz
Algorithm Hash digest
SHA256 1ec88367e787a28e310e047b8c785dceab1098914319206466b070444486c55f
MD5 7dda5a6db6f1c6f6d63ab47792a80044
BLAKE2b-256 1ec7d4007dd2b4cc5f677d07cfd9291df95098a59980b71596d9e7fe14c2f130

See more details on using hashes here.

File details

Details for the file job_scheduler-0.3.4-py3.7.egg.

File metadata

  • Download URL: job_scheduler-0.3.4-py3.7.egg
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.2

File hashes

Hashes for job_scheduler-0.3.4-py3.7.egg
Algorithm Hash digest
SHA256 34e378128ce9f47230be552118cb0fec2de9b06d6b8ac2353c0792a9b5a0ea1f
MD5 cce615eea11b993901730065f2ce3cc3
BLAKE2b-256 7f868bc7997a37145f1a71498c51ceaec90e4b14123dc14d698c45c1fbb7c47e

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