Hi Team, I’m trying Prefect following the guide do...
# ask-community
a
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
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
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
is it OK if the flow starts a few seconds early?
actually yes I know how to achieve this
a
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
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
that sounds good, I can try that 🙂
Thanks
c
awesome anytime - let us know if you run into any roadblocks!
a
cool, thanks!