Nicholas Pini
05/21/2026, 3:30 PMMarvin
05/21/2026, 3:30 PMMarvin
05/21/2026, 3:32 PMparent_task_run_id
- the child has its own flow_run_id
- logs are stored against that child flow_run_id, not “bubbled up” into the parent task log output
So if you want the parent task to “show” all subflow logs, you have to do that manually.
Typical options:
1. Log a summary in the parent task
- deployment run ID
- final state
- link to the child run in the UI
2. Query the child run’s logs via the API/client and re-emit them from the parent task
- workable, but manual
- can get noisy / duplicate logs
3. Use the UI to inspect the child run separately
- this is usually the intended Prefect model
Example pattern:
python
from prefect import task
from prefect.deployments import run_deployment
from prefect.logging import get_run_logger
@task
async def launch_subflow():
logger = get_run_logger()
flow_run = await run_deployment(
name="my-flow/my-deployment"
)
<http://logger.info|logger.info>(f"Subflow run created: {flow_run.id}")
<http://logger.info|logger.info>(f"Subflow final state: {flow_run.state_name}")
If you really want to fetch child logs and re-log them, you’d need to:
- find the child flow run(s)
- read their logs through the Prefect client
- emit those log lines again from the parent context
Important caveat:
- this replays logs into the parent; it is not true inheritance
- timestamps/order may not perfectly match live execution
- you may end up with duplicated logs in your system
If you want, I can give you a complete Prefect 3 example that:
- launches a deployment as a subflow
- waits for completion
- fetches all child logs
- re-emits them in the parent task log stream
Relevant docs:
- Run deployments
- Flows
- Logging