Hi there, what is the best way to trigger a flow f...
# ask-community
b
Hi there, what is the best way to trigger a flow from the state of another flow/s within a flow of flows? I.e, given flows
a
,
b
, and
c
started within parent flow
p
using
startflowrun
, how can I trigger (or not trigger) flow
c
, given the states of flows (startflowrun tasks)
a
and
b
? Within flows
a
and
b
, there is a task to skip downstream tasks (raising a SKIP signal) based on a condition. Thanks in advance.
k
Hey @Blake List, you need to use the GraphQL to query for the states of the tasks that you are interested in.
StartFlowRun
returns a key that you can pass to a query. This might be a starting point.
Copy code
client = Client()
    response = client.graphql(
        f"""
        query {{ 
          flow_run_by_pk ( id: "{flow_run_id}" ),
        {{ 
            id, 
            flow {{
              id,
              name,
            }}
            state,
            task_runs {{
              id, 
              state, 
              state_message,
              task {{
                id,
                name,
                slug,
                type
              }}
            }}
          }}
        }}"""
    )
    return