File size: 957 Bytes
ef987bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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:

```python
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.