https://prefect.io logo
Title
k

Krishnan Chandra

09/06/2022, 7:00 PM
Hey everyone! Trying to figure something out - in Prefect 1, is there a way to restart flow runs from the API? I am able to cancel flows via the API using the
cancel_flow_run
function but I don’t see a way to restart the run once cancelled
1
a

Anna Geller

09/06/2022, 8:39 PM
there is in theory but it would be very complicated -- it's easier to create a full new flow run
alternatively, using retries instead can make things easier to manage
k

Krishnan Chandra

09/06/2022, 8:41 PM
Got it - so then, is there a way to clone an existing flow run in the create command?
a

Anna Geller

09/06/2022, 8:42 PM
what do you mean by clone?
k

Krishnan Chandra

09/06/2022, 8:42 PM
In this case, retries won’t help me because the run has already finished
Basically, I have a set of flow runs that got stuck and are now cancelled- I want to restart/recreate those specific runs
a

Anna Geller

09/06/2022, 8:45 PM
I can't find the PR in the UI repo - this is the closes I could find https://github.com/PrefectHQ/ui/pull/285 but restart is super expensive and complicated operation and UI does a lot of magic here by executing multiple API calls in order to make that happen and it only works if you have results configured on all tasks
👍 1
I'd recommend commenting out the tasks that already completed/shouldn't be rerun and manually triggering such run if the UI feature doesn't satisfy your use case - would that work for you?
alternatively you can try doing sth similar to this proposal https://github.com/PrefectHQ/prefect/issues/5516
k

Krishnan Chandra

09/06/2022, 8:57 PM
Thanks Anna! I think the last link makes the most sense for me
👍 1