DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
|
Raw History Blame Contribute Delete
957 Bytes

PyCron interval scheduler

This closed fixture's original_go/cron.go contains an interval-scheduler behavior summary, not an executable Go implementation. The Python package implements that scope; it does not parse cron expressions.

CronScheduler.add_interval_job(seconds, callback) registers a callback with a positive finite interval. Jobs begin only after start(), run repeatedly, and stop after stop(). Repeated start() calls are idempotent; a stopped scheduler can be started again. Register jobs before starting. IntervalSchedule stores a validated interval.

Usage:

from pycron import CronScheduler

scheduler = CronScheduler()
scheduler.add_interval_job(0.1, lambda: print("tick"))
scheduler.start()
# Perform other work, then stop the scheduler.
scheduler.stop()

Run python example/example.py for a complete short-running example. The implementation uses only Python's standard library and needs no network access.