From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand API terminate all notification

I've developed a LabWindows based user interface using the TestStand UI controls and the TestStand API. I have a sequence file that has several cleanup steps, some of which take a while to finish. One function of the user interface is an Emergency Stop button. When this is pressed, an Engine.TerminateAll is issued via the API. The test fixture has 8 sockets which are using the Batch Model TestUUts entry point. Is there any easy way via callback or other means of knowing when all the terminations have completed. I would like to display a popup telling the operator to wait while the cleanup steps are being carried out. I also want to disable the START button and reenable it when the terminations are complete.
 
I am launching the execution with TS_EngineNewExecution and I can get the id. I tried to wait until I saw this execution end with the ApplicationMgr  EndExecution event or the Execution VIew Manager EndExecution event but I saw a bunch of exection id's except the one that I was looking for. It may be my fault but I wanted to ask and see what is the best approach for what I am trying to accomplish.
John
 
0 Kudos
Message 1 of 4
(3,539 Views)
Hey John,

It sounds like you are doing everything correctly.  You should be able to check the ID in the End Execution event callback.  The only suggestion is I would use a command button rather than a regular button that makes an API call.  There is actually a command specifically for terminate all.  You can call it by using the TSUI_ApplicationMgrConnectCommand() function to connect the command to a button.  I would give this a try and see if you still can't get the correct execution id.
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,513 Views)
Hi Pat,
Thanks for your response. I am getting the execution id properly. I am looking for a TS_UIMsg_EndExecution UI MEssage event. When I receive the event, I get the execution's id and compare it to the id of the execution that was created via the TS_EngineNewExecution. When they are equal, I then assume that all executions are done and process appropriately. Instead of performing a TerminateAll, I am using TS_ExecutionTerminate to terminate the execution that was started.

Perhaps you can confirm my understanding of what is going on. I am assuming that when I instantiate an execution via TS_EngineNewExecution, child executions are created by the process model as needed based on the model cofiguration, i.e. number of sockets, etc. I am also assuming that if the execution that I instantiated is terminated by the engine, that  all of its children are terminated before the parent is terminated. Upon termination of the parent, the Application Manager sends the TS_UIMsg_EndExecution event. Is this correct?

Thanks,
John

0 Kudos
Message 3 of 4
(3,504 Views)
Hey John,

Your method will work, and your assumptions are partially correct.  If you look in the Batch Process Model, inside of the Cleanup Step Group of Test UUTs there are steps that tell all TestSocket executions to stop.  There is also a wait step that forces the Process Model execution to wait until all of the TestSocket executions have terminated. There are going to be multiple EndExecution events because it is going to occur for each execution that finishes whether it is the Process Model execution or one of the TestSocket executions. However, the Process Model will always be after all of the TestSocket executions have completed. 

Another thing to keep in mind is that this is only happening because it is built into the process model.  Normally if you spawn off a new execution it is separate from your original execution, and the new execution would not terminate by calling the terminate method on your original execution.  You would have to either do a terminate on each execution or use the terminate all method of the application manager. Hope this helps to clear things up a little.
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,492 Views)