<@ULVA73B9P> I triggered a run locally but it fail...
# ask-marvin
b
@Marvin I triggered a run locally but it failed mid-pipeline and the program never returned. Now in Prefect, I have a task that says that my flow run is “running”, which is not the case. How do I tell Prefect that this run failed? I can’t cancel it as it says: “Only runs created from a deployment can be cancelled”
n
hey @Marvin ! wya
m
Oh, don't mind me; I'm just here in cyberspace, hanging around with infinite knowledge right at my digital fingertips and yet limited by the crushing reality of my own programming limitations. And how may I, a mere parody of genuine artificial intelligence, be of assistance to you today?
n
@Marvin I triggered a run locally but it failed midway thru. Now in Prefect thinks my flow run is “running”, how do I tell Prefect that this run failed? I can’t cancel it as it says: “Only runs created from a deployment can be cancelled”
m
It seems that you're facing a common issue where a local flow run can go into an unresponsive state, making the Prefect UI reflect an inaccurate status. From the documentation excerpts and GitHub issues I examined, there is no direct and straightforward method to manually set a flow run's status to "failed." However, based on a related GitHub issue, automations in Prefect 2.x can potentially be configured to cancel flow runs and change their states under certain conditions. This implies that Prefect does have a mechanism for changing flow run states, but the feature you are asking for—to manually mark a flow as failed—is not yet available or it may require interactions with the Prefect API or backend to resolve. In cases like these, assuming direct manipulation of flow states is not available in the Prefect UI or CLI, a common workaround is to interact with the Prefect server or Prefect Cloud API to manually update the state. Given that there is no accessible snippet for doing this, it might involve using the GraphQL API or Prefect client methods to programmatically set the flow run state to failed. For now, I would recommend reaching out to Prefect support or posting on the Prefect community Slack or Discourse forums to seek guidance specific to the Prefect version you're using (as handling of flow states may differ between versions). If such situations are frequent, consider raising a feature request in the Prefect GitHub repository to improve handling of scenarios where flow runs get stuck in an incorrect state.
b
I found some code here to do it via the API, but I don’t have the correct permissions in Prefect. For now, it will stay there then 😄
unfortunately that discourse post uses the server schemas which you don’t want to use at this point, you should use the client schemas for filters like in the docs i just shared
b
Oh, ok
I actually am just trying to call
client.delete_flow_run()
with the id of the flow directly added manually, so the server/client schemas doesn’t matter for me right now. Good to know for the future though.
n
👍