英文:
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 immediately run 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.
英文:
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.
答案1
得分: 0
我在找到解决方案时发现了相同错误。在流程函数所在的脚本中,我实际上是在脚本的末尾调用该函数。出于测试目的而这样做,并忘记去掉它。现在我已经移除它,一切都按预期工作。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论