Hi all, when I registered a flow, the flow-run wil...
# ask-community
e
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
Hi @Eric - I think the
ENDRUN
signal raised with a
Skipped
state will enable what you're describing. Check it out here.
e
@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
Ah I see. In that case you can find the
flow_run_id
in the context within any task run.
e
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
Nope you should be able to use that in Prefect Server as well.
e
OK!! I get the flow-run id correctly. It looks like on the right way🥺 Very appreciate for your help!!
n
Happy to help 🙂
e
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
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
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