Replies: 1 comment 1 reply
-
If there is no built-in easy way, then I think this custom condition might be good enough: @app.cond()
def at(dt, task = Task()):
return task.last_run is None and datetime.now() >= dt |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm slightly confused because this seems like a pretty basic thing that one would want to do, but I can't find anything on this topic in the documentation and in discussions/issues. Is it possible to schedule a task to run only once at a specific datetime?
You might be wondering what's the use case here. See, I need to create some tasks dynamically without knowing the condition beforehand. Let's say that I have some task that itself is running periodically with a static condition (like once a minute), fetches some data, and then schedules other tasks based on this data. Dynamic scheduling is of course possible using
create_task
method and everything would work great if these new tasks were periodic. But here I don't need them to be periodic. I just need to run them once at some point in the future (and this point comes from the data fetched dynamically at runtime).In static scheduling, this is probably less common, but you can also imagine one wanting to do something along the lines of:
Is it possible to do with the current state of the project? I feel like I might be missing something.
Beta Was this translation helpful? Give feedback.
All reactions