Florent VanDeMoortele
04/08/2024, 4:42 PMMarvin
04/08/2024, 4:43 PMFlorent VanDeMoortele
04/08/2024, 5:04 PMMarvin
04/08/2024, 5:05 PMprefect.runtime
, which it mentions for accessing flow information, and specifically check if it provides a way to reference the parent flow. The Prefect community and forum might also have examples or discussions related to this use case that could be helpful.Florent VanDeMoortele
04/08/2024, 5:09 PMMarvin
04/08/2024, 5:09 PMpython
from prefect import Client
client = Client()
# Replace 'YOUR_FLOW_RUN_ID' with your actual flow run id
flow_run_id = 'YOUR_FLOW_RUN_ID'
# Get Flow Run information
flow_run_info = client.get_flow_run_info(flow_run_id)
# Extract the Flow Name
flow_name = flow_run_info.flow.name
print(f"The flow name is: {flow_name}")
This code uses the Client
to fetch the flow run information, which contains the flow name among other details. Remember to replace 'YOUR_FLOW_RUN_ID'
with the actual flow run ID you are querying.
Unfortunately, the documentation excerpts do not directly describe the method to achieve this, but the Prefect Client is generally the tool used to interact with the Prefect API, including retrieving such data. For more detailed information on using the Prefect Client, check out the guide:
- Using the Client
Please note that you will need the appropriate credentials and API settings configured to use the Prefect Client, which are usually set in your Prefect configuration file or environment variables.