Make jobs start with zero offset to actual time by default
- Dominant language
- Python
- Stars
- 12.3k
- Forks
- 999
- PR merge metrics
- No merged PRs in 30d
Description
It would be handy to start jobs relative to the actual time by default (and not relative to the scheduler process start time - as it is now). Take as example [schedule.every(15).minutes.do(job)](https://github.com/dbader/schedule/issues/283) I expect it to work the same as `0,15,30,45 * * * *` cron works.
This project has many issues asking similar question "How do I run job in x.y period at specific time". Most of those question define "specific time" as offset zero to actual time.
There is an `at(` function that seems to be the solution, but the solution isn't that strait forward.
The work around is to specify multiple jobs with higher run period and lock down the the time the job should run at.
In our example this is
```
step = 15 # every x minutes
for minute in range(0, 60, step):
time = ":{minute:02d}".format(minute=minute)
schedule.every().hour.at(time).do(job)
```
this solution works just fine, but doesn't seem to be natural.
Implementing this feature shouldn't be a breaking change us such, because current code allows to run scheduler with zero offset to the actual time be simply starting scheduler at full hour time.
Nice to have on top of this feature for me is to implement https://github.com/dbader/schedule/issues/240 that is going to give full control over jobs offset time.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing how schedule.every(...).do(job) calculates its first run and compare that behavior with the existing at() path. Review issue #240 for the related offset-control proposal. Done means default periodic jobs align with zero-offset wall-clock times while explicit scheduling behavior remains understood and covered by the project's existing checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100