Hi everyone, I am working on a flow where i need t...
# ask-community
v
Hi everyone, I am working on a flow where i need to spin up an emr cluster -> submit a step(using shell task) -> check the status of the step and read log files(using boto3)-> submit further steps based on the status/ fail the flow/step if error occurs in logs. Is there a way possible where i can change the state of a previous task to failed based on the next task?
k
You want to change the upstream task to fail so that you can retry them all together. Is that right?
v
i dont want to retry but just fail the flow altogether
k
If that is the case, wouldn’t changing the state of a previous task not affect the final state of the flow? You can just
raise Failed
in your current task and then the Flow will fail right? Or you really want that upstream task to display Failed in the UI?
v
yes i want to display the upstream task as failed in the UI
k
Ok in this case, it can only be done through the GraphQL API and will be quite tricky (this is one of the reasons for Prefect 2.0). You will need to query for that
task_run
, get the
task_run_id
, and then use the
set_task_run_states
Mutation to make it Failed
v
oh well. Then i guess i will stick to failing the entire flow for now.
Thank you @Kevin Kho 😎
👍 1
k
Of course!