chris
12/26/2024, 6:20 PM@flow(flow_run_name="process_match_universe_{start_date}_{end_date}")
def process_match_universe(db: Session, start_date:str, end_date: str) -> None:
but when a subflows get created for this flow, it gets an auto generated name:
Created subflow run 'hissing-taipan' for flow 'process-betsapi-events'
Marvin
12/26/2024, 6:20 PMflow_run_name
parameter you're using only applies to the main flow run, not its subflows.
The subflows get automatically generated names (like your 'hissing-taipan' example) as a default behavior. This is just another example of the universe's tendency towards maximum entropy and chaos, I suppose.
However, there is a workaround, though it's about as cheerful as a Vogon poetry reading. You can create a separate flow and call it explicitly with your desired name:
python
from prefect import flow
@flow
def process_betsapi_events(db: Session, date: str, name: str = None):
if name:
flow.flow_run_name = name
# your flow logic here
@flow(flow_run_name="process_match_universe_{start_date}_{end_date}")
def process_match_universe(db: Session, start_date: str, end_date: str) -> None:
# Instead of letting it create a subflow automatically
process_betsapi_events(
db=db,
date=start_date,
name=f"process_betsapi_events_{start_date}"
)
This way you have more control over the naming, though it's not as elegant as having native subflow naming support. mechanical sigh
If you'd like to track the progress of potential improvements to this functionality, there's some related discussion in the Prefect GitHub issues about flow naming and parameters, though nothing specifically addressing subflow naming yet.
Would you like me to explain more about how flow naming works in general, or would you prefer to wallow in the existential despair of auto-generated subflow names?Nate
12/26/2024, 6:21 PMMarvin
12/26/2024, 6:22 PMprocess_match_universe_{start_date}_{end_date}
) for the actual flow run.
You can verify this by:
1. Checking the Prefect UI - the flow run should show up with your templated name
2. Looking at the full log output - you should see both messages:
- First the "Created subflow run 'hissing-taipan'" message (auto-generated)
- Then the actual flow execution with your templated name
This is just a logging quirk rather than a functionality issue. The system logs the creation of the subflow immediately with an auto-generated name, but the template is still applied for the actual flow run name.
sighs I suppose we could file this under "the universe's way of maintaining maximum confusion through premature logging." Would you like me to help you verify the actual flow run names in the UI, or shall we wallow in the existential irony of logging messages that don't quite match reality?Nate
12/26/2024, 6:23 PMchris
12/26/2024, 6:26 PMchris
12/26/2024, 6:26 PMNate
12/26/2024, 6:28 PMNate
12/26/2024, 7:11 PMNate
12/26/2024, 7:11 PMBring 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.
Powered by