0

I have a 5 steps Argo-workflow: step1: create an VM on cloud step2: do some work step3: do some more work step4: do some further work step5: delete the VM

All the above steps are time consuming. And for whatever reasons, a running workflow might be stopped or terminated by issuing the stop/terminate command.

What I want to do is, if the stop/terminate command is issued at any stage before step4 is started, I want to directly jump to step4, so that I can clean up the VM created at step1.

Is there any way to achieve this? I was imagining it can happen this way:

  1. Suppose I am at step2 when the stop/terminate signal is issued.
  2. The pods running at step2 gets a signal that the workflow is going to be stopped.
  3. The pods stop doing their current work and outputs a special string telling the next steps to skip
  4. So step3 sees the outputs from step2, skips its work and passes it on to step4 and so on.
  5. step5 runs irrespective of the input and deletes the VM.

Please let me know if something like this is achievable.

Chayan Ghosh
  • 718
  • 5
  • 18

1 Answers1

0

It sounds like step 5 needs to be run regardlessly, which is what exit handler is for. Here is an example. Exit handler would be executed when you 'stop' at any step, but would be skipped if you terminated the entire workflow.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). –  Oct 21 '21 at 10:08