Alfie

    Alfie

    2 years ago
    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.
    Chris White

    Chris White

    2 years ago
    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)
    Alfie

    Alfie

    2 years ago
    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?
    Chris White

    Chris White

    2 years ago
    is it OK if the flow starts a few seconds early?
    actually yes I know how to achieve this
    Alfie

    Alfie

    2 years ago
    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?
    Chris White

    Chris White

    2 years ago
    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
    Alfie

    Alfie

    2 years ago
    that sounds good, I can try that 🙂
    Thanks
    Chris White

    Chris White

    2 years ago
    awesome anytime - let us know if you run into any roadblocks!
    Alfie

    Alfie

    2 years ago
    cool, thanks!