Solved

Calling a process block multiple times from within a script.

  • 21 March 2024
  • 2 replies
  • 24 views

Userlevel 5
Badge +16

I have the following function setup in a script :

 

JSONObject getVmwareApiOutput(String apiUrl, String vCenterSessionToken){
ExecuteSuperProcess getVmwareApi = new ExecuteSuperProcess();
getVmwareApi.processBlock = WorkflowElement.parse("<processBlock>pbGetVmwareApi</processBlock>");
getVmwareApi.inputs = WorkflowElement.parse("<inputs><url>" + apiUrl + "</url><vmware-api-session-id>" + vCenterSessionToken + "</vmware-api-session-id></inputs>");
getVmwareApi.execute(workflow);
JSONObject vmWareApiOutput = new JSONObject(xpath:{/workflow/variables/restCallOutPut}.replace("[","").replace("]",""));
return vmWareApiOutput;
}

 

This works fine the first time I call the script.

But subsequents calls result in the following:

 

9908 ExecuteSuperProcess     : [Search vCenters for Virtual Machines (scrSearchForVirtualMachine)] process block for super process id [9321], has already completed
9908 ExecuteSuperProcess     : [Search vCenters for Virtual Machines (scrSearchForVirtualMachine)] process block for super process id [9321], has already completed
9908 ExecuteSuperProcess     : [Search vCenters for Virtual Machines (scrSearchForVirtualMachine)] process block for super process id [9321], has already completed

icon

Best answer by Chris Sunderland 21 March 2024, 20:29

View original

2 replies

Userlevel 3
Badge +6

So, are you trying to call the ExecuteProcessBlock multiple times within the same Script?

Can you see if you can design it so that you are inside a ForEach block or something that can call the ExecuteProcessBlock in each iteration so we don’t try to re-use the same process step id?

Another option to test is make the ProcessBlock of separate workflow and see if that works better being called multiple times within the same script.

 

 

 

Userlevel 5
Badge +16

So, are you trying to call the ExecuteProcessBlock multiple times within the same Script?

Correct. I want to use it to call http client and save the output. This was a lot easier by just calling a process block.

Can you see if you can design it so that you are inside a ForEach block or something that can call the ExecuteProcessBlock in each iteration so we don’t try to re-use the same process step id?

It would be really tricky.

Another option to test is make the ProcessBlock of separate workflow and see if that works better being called multiple times within the same script.

 

 

That might be the “nuke it from orbit” option. 

 

Reply