Stop a schedule when process fails

Pretty much what the title says, is there a way to stop a schedule if the process fails? Say i have a process running every 10 minutes and this for some reason fails. having it keep doing the task that fails over and over seems unnecessary

Please go through above WF example screenshot. In the same example if you enter a counter and put a exit condition once counter reaches after several attempts to make Setme1=Setme2 condition. that will exit the loop.

Hope my inputs are useful.

I’m sorry. I think i wasn’t clear enough. I want to stop the schedule in orchestrator.

But after some digging i believe i can do it through the api somehow