https://prefect.io logo
Title
e

Eric

08/21/2020, 3:01 AM
Hi all, when I registered a flow, the flow-run will be created automatically depends on the given schedule with python code. I wonder are there any ways to mark a flow-run "skipped" when the task found the connection to RDB is temporary dropped(in our use case, we need "skipped" instead of "failed"). That is, I want to change the flow-run mark in Task layer. Is that possible? I've found a way is "`client.set_flow_run_state(flow_run_id="ce7ce40b-a21b-4273-b39f-6ebea071a76e", state=skip_state)`", but the flow-run is created by scheduler, I could not find the flow-run id automatically. Thanks!!
n

nicholas

08/21/2020, 3:09 AM
Hi @Eric - I think the
ENDRUN
signal raised with a
Skipped
state will enable what you're describing. Check it out here.
e

Eric

08/21/2020, 3:21 AM
@nicholas but I use
refect.engine.signals.ENDRUN(skip_state)
It only changes the task status, the flow-run status still shows "success"
I hoped the flow-run status will also shows "skipped" 🥺 Thank you a lot
n

nicholas

08/21/2020, 3:31 AM
Ah I see. In that case you can find the
flow_run_id
in the context within any task run.
e

Eric

08/21/2020, 3:38 AM
I've read this doc, and it says flow_run_id in context is supported by Prefect Cloud, so I cannot use this at local Prefect Server, right? Thanks
n

nicholas

08/21/2020, 3:44 AM
Nope you should be able to use that in Prefect Server as well.
e

Eric

08/21/2020, 3:53 AM
OK!! I get the flow-run id correctly. It looks like on the right way🥺 Very appreciate for your help!!
n

nicholas

08/21/2020, 3:58 AM
Happy to help 🙂
e

Eric

08/21/2020, 4:08 AM
Oh... @nicholas Sorry for bothering you again >< The log shows that I successfully changed the flow-run mark but at the end of the flow-run it change back to success stat. The code below is my code fragment, are there any mistakes in my code..? thank you :(
n

nicholas

08/21/2020, 4:40 PM
Sorry @Eric - I thought we had better support for this than we do to set the flow run state. I've opened a ticket to explore how we can make this happen for a use case like yours 🙂
e

Eric

08/24/2020, 12:11 AM
Thank you very much @nicholas. It's also okey for us to treat the flow-run "success" state like "this flow-run is successfully executed, but the task is skipped because of some conditions." Anyway, as you said "Allow something akin to
flow.set_reference_tasks
to finely dictate the final state of a flow run", it's better if Prefect provide the function like this 😄 My colleagues and I appreciate your help very much. Thank you 😊
😄 1