Hey prefect devs, are default parameters (in this case dates) decided at the time a flow is registered or when the flow is executed following a daily schedule? I have a job that is registered to the prefect-server and takes in a date range wrt the date of execution.
For example:
Copy code
with Flow("my_daily_flow", schedule) as flow:
start_date = Parameter("start_date", default=datetime.utcnow().date() - timedelta(days=5))
end_date = Parameter("start_date", default=datetime.utcnow().date())
daily_job.set_dependencies(keyword_tasks={"start_date": start_date, "end_date": end_date})
flow.register("test")
This question might have been asked before, but I would like some confirmation. Thank you!
k
Kevin Kho
07/16/2021, 1:29 PM
Hi @Goh Rui Zhi, if a flow is serialized (which is the default behavior)), these dates are saved during build time. If you want to bring it to the runtime, you can use a string like
Hi, I have another question here on the subject. How can I get the value of a schedule to a parameter? E.g. if my schedule runs every hour, I want the time of the schedule. I understand I can get the current time, but what would happen if I restart the flow 3 days later? Which time would it use? Thanks!
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.