I know I can get the actual time the flow was entered with
prefect.context.get_run_context().start_time
, but that seems a little dangerous if the run is late; I'd rather pull the scheduled time if possible
✅ 1
c
Chris White
04/13/2023, 4:01 PM
Hi Andy; if you put your deployment on a schedule, then the parameters will end up being either their default values or the values you set as default on the deployment.
You can use
prefect.runtime
to access contextual information such as scheduled start time, so here's the pattern I recommend:
Copy code
@flow
def my_flow(x: datetime = None):
if x is None:
x = prefect.runtime.flow_run.scheduled_start_time
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.