Anton L.
02/20/2024, 1:47 PMMarvin
02/20/2024, 1:47 PMprefect.context.get_run_context()
function. This function can help you retrieve the context of the flow run and potentially the datetime it was scheduled. Unfortunately, the exact answer for accessing the scheduled datetime is not directly found in the given excerpts.
For more detailed information on accessing the flow context and retrieving specific runtime information such as the scheduled datetime, please refer to the Prefect documentation on runtime context here.
The guide on schedules might also offer some clues, but you might need to dig deeper for specifics regarding the scheduled datetime here.
If you face an exception with get_run_context()
, it means you are not in a flow or task run, and if you want to access the flow run context specifically, even from within a task, you should explicitly access the flow run context. For example:
python
from prefect import context
flow_run_context = context.get_run_context().flow_run
# Access specific attributes of the flow run context here
Please note that not all desired metadata might always be available directly in the context, depending on the execution environment and how Prefect is configured.