pythonprefect

Prefect deploy in python "no-start" option


I want to deploy a prefect flow in python. So far I've been using a script like this:

deployment = Deployment.build_from_flow(
    flow=flow_name,
    name="deployment_name", 
    version=1, 
    work_queue_name="queue_name",
    schedule=CronSchedule(cron="0 23 * * *")    
)
deployment.apply()

It works fine, but every time I restart the code it will immediatly runs the flow. I want it to only run when scheduled. I know if you run prefect from command line there is a "no-start" option, but so far i haven't been able to find how to implement it in Python.


Solution

  • I found the solution in case anyone runs across the same mistake. In the script where the flow function was, I was actually calling the function at the end of the script. Did it for testing purposes and forgot to take it off. So now that I removed it, everything works as intended.