VMware Cloud Community
DeanRavenscroft
Contributor
Contributor
Jump to solution

Is there a way to track unfinished Actions?

I am using vRO 7.5 in this environment.

For example.

If I write an action that executes something that takes 2 hours (example only, I hopfully wouldnt ever do this Smiley Happy )

This action is run by a workflow, then say the workflow either fails or is cancelled, is there a way to list anything that may not have completed yet?

I want to make sure there is nothing taking up resources when it is no longer valid.

Thanks all!

Cheers

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Actions are just a big chunk of scripting code, passed directly to scripting engine for execution (like an object method call in programming languages). They do not have execution tracking mechanism, they don't even have their own execution token which you can query for the current execution status.

One option is to manually implement your own tracking mechanism, that is, somehow update some object external to the action (ie. resource/configuration element) with information that you can later use to check what action managed to execute before its parent workflow has been cancelled/failed. But this is not a generic solution, it should be designed and implemented for each of your long-running actions, taking care of specifics in their scripting code.

View solution in original post

Reply
0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Actions are just a big chunk of scripting code, passed directly to scripting engine for execution (like an object method call in programming languages). They do not have execution tracking mechanism, they don't even have their own execution token which you can query for the current execution status.

One option is to manually implement your own tracking mechanism, that is, somehow update some object external to the action (ie. resource/configuration element) with information that you can later use to check what action managed to execute before its parent workflow has been cancelled/failed. But this is not a generic solution, it should be designed and implemented for each of your long-running actions, taking care of specifics in their scripting code.

Reply
0 Kudos
stevedrummond
Hot Shot
Hot Shot
Jump to solution

I thought cancelling the workflows killed the executing code?

Or are we talking about running purely an action via the API?

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Yes, cancelling a workflow should stop the currently executing action code.

However, there are cases when not everything will be stopped. Consider the case when you have a workflow which calls an action, and inside the action code you launch one or more other workflows. When you cancel the top workflow, the action will also stop, but the workflows launched by the action code will continue to run. So if you want to do a proper cleanup, then you should somehow track which workflow have been launched by the action code, and stop them one by one.

stevedrummond
Hot Shot
Hot Shot
Jump to solution

Well that becomes tracking an unfinished workflow at that point right?

Hopefully no one would expect cancelling the parent would cancel any asynchronously launched jobs, whether that's workflows, scripts or even non-vRO jobs.