DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
Raw History Blame Contribute Delete
607 Bytes
"""Example usage of the pycron scheduler.
This runnable example demonstrates the core features; see README.md for the
full documentation and additional usage examples.
"""
import time
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from pycron import CronScheduler
if __name__ == "__main__":
scheduler = CronScheduler()
counter = {"count": 0}
scheduler.add_interval_job(0.05, lambda: counter.__setitem__("count", counter["count"] + 1))
scheduler.start()
time.sleep(0.18)
scheduler.stop()
print(f"executions={counter['count']}")