Hi again, what would be the easiest way to program...
# ask-community
m
Hi again, what would be the easiest way to programmtically get the tasks that failed and those that trigger failed given a flow run id ?
a
Probably using GraphQL client i guess
m
Yes - probably - but I am not sure how the query would look
k
Hey @Marwan Sarieddine, An augment of this query will be useful:
Copy code
query {
  task_run(
      where: {
          state: {_eq: "Failed"},
          flow_run_id: {_eq: "YOUR_FLOW_RUN_ID"},
        }
    ) {
    cache_key,
    created,
    end_time,
    ...
  }
}
Not sure on the trigger failed part, looking into that - will likely be looking for those task runs that ended in a
TriggerFailed
state.
m
Hi @Kyle Moon-Wright - thank you for your suggestion: I would like to know the task names that failed - so following your template I wrote up this query:
Copy code
query {
  task_run(
      where: {
          state: {_eq: "Failed"},
          flow_run_id: {_eq: <flow_id>},
        }
    ) {
    name,
  }
}
and here is what I get -
Copy code
{
  "task_run": [
    {
      "name": null,
      "__typename": "task_run"
    },
    {
      "name": null,
      "__typename": "task_run"
    },
    {
      "name": null,
      "__typename": "task_run"
    },
    {
      "name": null,
      "__typename": "task_run"
    }
  ]
}
but I see
null
values not the task names ...
ah nevermind this is the task run name not the task name
ok solved
Copy code
query {
  task_run(
      where: {
          state: {_eq: "Failed"},
          flow_run_id: {_eq: "<flow_id>"},
        }
    ) {
    task{
      name
    },
  }
}
💪🏼 1
@Kyle Moon-Wright - thank you!
k
np, glad you noticed that 👍