VMware Cloud Community
mcfadyenj
Hot Shot
Hot Shot
Jump to solution

exception handling during loops

hi all is it possible to handle exceptions during a loop in a workflow.

for example I have a mass deployment workflow which is cloning servers on bulk. Can I check return codes on the clone_vm task and log all and either bail or continue based on return codes.

in some situations I would like to attempt / fail continue loop.

in others I would like to attempt fail stop loop.

Is there any samples anywhere I could look over.

0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

You could start your clone as a parallel workflow in a parent workflow and check on the workflow token status to start a remediation workflow. Check for "Start workflows in parallel" in the library as a basis.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

0 Kudos
5 Replies
cdecanini_
VMware Employee
VMware Employee
Jump to solution

You could start your clone as a parallel workflow in a parent workflow and check on the workflow token status to start a remediation workflow. Check for "Start workflows in parallel" in the library as a basis.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

Hi!

One possible strategy is to "log" any issues or exceptions in an external list or protocol. So you can let run the workflow completely, and in the end the user gets the protocol.

If you want to react on exceptions inside your loop you can use the exception-paths and exception-bindings in schema editor.

See attached workflows for an example... (one WF throws exception, the other one handles the exception)

Regards,

Joerg

tschoergez
Leadership
Leadership
Jump to solution

I found one example with exception in loops. Unfortunately I cannot upload it, because it was a customer project, but the screenshot will get you an idea...:

screenshot0011.png

Regards,

Joerg

cdecanini_
VMware Employee
VMware Employee
Jump to solution

You can either:

  • Implement the exception handling in the loop of the master workflow doing the clone (or other) as shown in Joerg screenshots
  • Start the workflows in parallel, monitor the workflows and handle the exception
  • Start the workflows in parallel with handling the exception in the workflow started in parallel.

Different implementations may be more adapted depending on your use case (i.e generic error handling or very specific to the master workflow), on if you want to run the operation in serial or parallel. if the later and if possible / make sense the exception should be handled within the called workflow.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
mcfadyenj
Hot Shot
Hot Shot
Jump to solution

thanks guys this is great stuff. The workflow diagram speaks a 1000 words. It makes more sense now.

0 Kudos