https://prefect.io logo
Title
a

Alfie

06/27/2020, 2:31 AM
Hi Team, I’m trying Prefect following the guide doc, and found that there is a few seconds latency between triggering a flow to run via CLI “prefect run server --name hello-flow” and the agent runs the flow. Is that expected? Thanks.
c

Chris White

06/27/2020, 2:32 AM
Hi Alfie - yup that’s expected; the agent polls on a backoff so if it’s not finding work it will sleep for up to 10 seconds before polling again
also, depending on the type of agent and the execution environment, the infrastructure setup for your flow could take a little while as well (e.g., a k8s agent running a flow with a DaskKubernetes Environment could add some additional latency)
a

Alfie

06/27/2020, 2:37 AM
thanks Chris. I need a scheduled flow, and want it to run at exact 0 min 0 second of every hour, is it possible to make it happen?
c

Chris White

06/27/2020, 2:37 AM
is it OK if the flow starts a few seconds early?
actually yes I know how to achieve this
a

Alfie

06/27/2020, 2:39 AM
No. I need to use the start time for querying a db. Maybe another way is to pass the time as a parameter
what’s the way?
c

Chris White

06/27/2020, 2:39 AM
before I jump there, it sounds like you just need to use the
scheduled_start_time
field in context to construct your query? This field always has the precision of your schedule even if your flow begins a few seconds late
you can access
prefect.context.scheduled_start_time
from within any task / state handler
a

Alfie

06/27/2020, 2:41 AM
that sounds good, I can try that 🙂
Thanks
c

Chris White

06/27/2020, 2:41 AM
awesome anytime - let us know if you run into any roadblocks!
a

Alfie

06/27/2020, 2:42 AM
cool, thanks!