S K
02/23/2021, 7:03 PMNeed help here. Trying to do in python as below. This is to check the flow state and cancel in the flow is in running state. How to pass the values to "$flowRunId: UUID!" import prefect
from prefect import Client
from prefect import task, Flow
@task()
def check_runs():
c = Client()
query = """
query RunningFlowsName {
flow(where: {name: {_eq: "flowstatechecktest"}}) {
id
} } """
print('======')
print(c.graphql(query=query))
query2 = """
query RunningFlowsState {
flow_run(where: {state: {_eq: "Running"}}) {
state
} } """
print('======')
print(c.graphql(query=query2))
query3 = """
mutation CancelFlowRun($flowRunId: UUID!) {
cancel_flow_run(input: {flow_run_id: $flowRunId}) {
state
} } """
c.graphql(query=query3)
with Flow("flowstatechecktest") as flow:
check_runs()
flow.run()
Jenny
02/23/2021, 7:33 PM