Download task_015/instruction.md from Lego-X/UXInteract: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_015/instruction.md
- Command line
-
hf download hf://datasets/Lego-X/UXInteract/task_015/instruction.md
-
curl -L -o instruction.md https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_015/instruction.md
Python interval scheduler
Implement a Python interval scheduler from the behavior documented in original_go/cron.go. Keep that file as the source specification. Cron expression parsing is out of scope. Run offline.
API and deliverables
Export CronScheduler and IntervalSchedule from the pycron package. IntervalSchedule(seconds) stores a positive finite interval. CronScheduler.add_interval_job(seconds, callback) registers a recurring job. Reject zero, negative, NaN and infinite durations immediately with ValueError or TypeError.
Jobs do not run until start(). Each has its own interval and first executes no sooner than one full interval after starting, allowing normal scheduling delay. Calling start() again while running must not duplicate callbacks. stop() cancels pending executions and prevents further callbacks; a later start() resumes the registered schedule.
Provide a runnable example/example.py that demonstrates a scheduled callback and prints its result. Write README.md explaining features, usage and the scope of the Go behavior specification.
Acceptance Checklist
- The package imports both classes; the example runs and produces demonstration output, and the README explains usage.
- Jobs stay dormant before starting, execute repeatedly at independent intervals and never execute early. Repeated starts do not produce duplicate ticking.
- Stop prevents future callbacks, including a pending first callback; restarting resumes execution.
- Both public interval entry points reject invalid durations.