<@ULVA73B9P> given a flow that runs a bunch of sub...
# ask-marvin
m
@Marvin given a flow that runs a bunch of subflows, how can i gather all of the logs for the parent flow and subflows via the API?
m
To gather all of the logs for a parent flow and its subflows via the Prefect API, you can follow these general steps: 1. Ensure each flow and subflow is utilizing
get_run_logger()
to log messages. 2. Use the flow's unique
flow_run_id
to query logs through the API. Unfortunately, the search did not return a direct answer or code example specifically for retrieving all logs from both flows and subflows through the Prefect API. However, here's a conceptual approach: - First, get the
flow_run_id
of the parent flow, which should typically be available in the flow's context or from the state of the flow run. - Then, query the Prefect API for all the logs associated with that
flow_run_id
. - If your subflows are separate flow runs, you would need to collect the
flow_run_id
for each subflow run and repeat the log query for each subflow. This process is not provided in the returned documents, so you may need to reference the Prefect API documentation or look for any relevant API endpoints that pertain to log retrieval. If you need a detailed example or specific API methods to accomplish this task, please let me know so that I can assist you further.