https://prefect.io logo
Title
v

Vadym Dytyniak

03/17/2022, 11:37 AM
Hi. 1. Is it possible to specify timeout for wait_for_flow_run task? 2. Is it possible to use prefect.Client to cancel Prefect flows by name?
a

Anna Geller

03/17/2022, 11:49 AM
#1 Try:
wait_for_flow_run(task_args=dict(timeout=3600))
# 2 Not directly, but you can retrieve the flow run ID from the prefect context and use it to cancel the flow run. Also: you can't cancel flows, only flow runs, and for that, you need the flow run ID Can you describe your use case more?
v

Vadym Dytyniak

03/17/2022, 12:38 PM
We use ECS and sometime using create_flow_run tasks just hangs in submitted state, we would like to have some cleaning at the start of next run.
a

Anna Geller

03/17/2022, 12:55 PM
So your flow runs are stuck in a submitted state? This would indicate issue with the execution layer
v

Vadym Dytyniak

03/17/2022, 12:59 PM
yes
k

Kevin Kho

03/17/2022, 1:54 PM
You can also try
wait_for_flow_run.timeout = ...
v

Vadym Dytyniak

03/17/2022, 2:03 PM
Is it possible to filter by jsonb field when using graphql?
Flow run has field serialized_state
I would like to filter by type field in this jsonb
k

Kevin Kho

03/17/2022, 2:28 PM
What query/mutation are you looking at?
v

Vadym Dytyniak

03/17/2022, 2:30 PM
I have already found, thanks
k

Kevin Kho

03/17/2022, 2:30 PM
Nice!
v

Vadym Dytyniak

03/17/2022, 2:30 PM
query {
            flow_run(where: 
              { 
                name: { _like: "pattern.%" }, 
                state: { _eq: "Submitted"}
              }
            ) {
                id,
    						name,
    						state,
    						created
        }
    }
I wanted to list submitted runs and when they started
I was trying to filter by jsonb field, but then found state field
k

Kevin Kho

03/17/2022, 2:31 PM
Ahh I see
v

Vadym Dytyniak

03/17/2022, 2:31 PM
but would be great to understand - is it possible to filter by jsonb field?
k

Kevin Kho

03/17/2022, 2:40 PM
Maybe with _contains but I don’t think so. I may be wrong though