-
Notifications
You must be signed in to change notification settings - Fork 972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start a repeating job at a specific time. #568
Comments
Hi @paudrow, thank you for the suggestion! Currently Assuming we want to keep the def after(
self,
after_time: Union[datetime.datetime, datetime.timedelta, datetime.time, str],
):
Schedule job to start running only after the specified moment.
The first execution is delayed until after_time is reached. If after_time
is in the past, the `.after()` has no effect.
:param until_time: A moment representing the earliest time a job can
be run. If only a time is supplied, the date is set to today.
The following formats are accepted:
- datetime.datetime
- datetime.timedelta
- datetime.time
- String in one of the following formats: "%Y-%m-%d %H:%M:%S",
"%Y-%m-%d %H:%M", "%Y-%m-%d", "%H:%M:%S", "%H:%M"
as defined by strptime() behaviour. If an invalid string format is passed,
ScheduleValueError is thrown.
:return: The invoked job instance Examples using relative timestamps:
Like this, the |
@SijmenHuizenga, yes, exactly! |
Yes, this is also exactly what I need! It would be great if this function could be implemented in schedule. |
It's very nice that schedule has
until
, but it feels like the project is missing afrom
(or similarly named function). For example, if I want to run a job every minute between the hours of 10am and 2pm.The syntax, with until, could be something like the following:
There is some ambiguity about what happens around midnight. I would think a reasonable option would be to
until
time or midnight andfrom
time.The best workaround that I can think of to get the
from
behavior is to schedule a job at a specific time to run once and have that job schedule other jobs that run until anuntil
time. This is a bit clunky to me.Thanks for the great library!
The text was updated successfully, but these errors were encountered: