Hi all-- I am evaluating Prefect (Orion) and had a...
# best-practices
j
Hi all-- I am evaluating Prefect (Orion) and had a question. What is the best way to dynamically trigger a scheduled flow run at a specified time? I have a nightly flow that picks up a start time from an API, and I'd like to have it then schedule a different flow to run at that time (only once though). Thanks for any help
1
k
You need to use the
client.create_flow_run_from_deployment
here , and then pass a Scheduled state with the scheduled datetime to that call
j
This is helpful, thanks Kevin. Just going through these docs, could I just use
client.create_flow_run
and pass it the
flow_id
and
scheduled_start_time
?
k
Could you show me what you are looking at?
But basically this interface looks like exactly what I need I think
I see now what you were saying-- so I would use this https://orion-docs.prefect.io/api-ref/prefect/client/#prefect.client.OrionClient.create_flow_run_from_deployment with
state=Scheduled(start_time=start_time)
k
Ah yeah that is for Prefect 1. Yes the API is different between the two. It will be easier in Prefect 1 for now it seems
Yes exactly!
j
Awesome thanks!