Hi! I’m trying to trigger a flow from another flow...
# ask-community
l
Hi! I’m trying to trigger a flow from another flow using
StartFlowRun
and running into an issue where the flow cannot be found, even though that flow exists. I’ve attached the stack trace of the error as well as a screenshot of our flows, to show that we do have one named
final_stats-staging
. Any help here would be great- thanks!
j
Hi @Linnea Sahlberg - can you share the code you're using for the StartFlowRun task? (And could you also please move the screenshots into the thread - it makes it easier for us to scroll through the channel if initial messages are kept short.)
l
Hey @Jenny - sorry about that! I’ll reattach those screenshots below. Here is the code:
Copy code
def build_flow() -> Flow:
    start_final_stats_flow = StartFlowRun(wait=False)
    with Flow(
        FLOW_NAME,
        executor=LocalDaskExecutor(scheduler="threads"),
    ) as flow:
        final_stats_flow_name = resolve_final_stats_flow_name()
        final_stats_params = generate_final_stats_params.map(map_result)

        start_final_stats_flow.map(
            parameters=final_stats_params,
            project_name="minion_pipeline",
            flow_name=unmapped(final_stats_flow_name),
        )
        return flow

@task(result=PrefectResult())
def resolve_final_stats_flow_name() -> str:
    if is_production():
        return "final_stats-production"
    return "final_stats-staging"
Also probably important to note, the flow that calls
StartFlowRun
is v0.14+ and the
final_stats-staging
flow is prefect v0.12
j
Thanks @Linnea Sahlberg - Could you try adding unmapped to your project name?
project_name=unmapped("minion_pipeline")
l
Ahh yep, that was it! 👍 Thanks so much
👍 1