NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Number of Active Test Sockets in Batch Process Model

Hi,

I am using a Batch Process model to test 4 UUTs. I am enabling "immediately go to cleanup on sequence failure".

During the execution I am using Rendezvous steps at numerous points in the sequence to enusre UUTs wait for each other at certain points.

In the  "Create Rendezvous" I need to set the number of threads per Rendezvous..

Is there a way to programmatically read how many test sockets are actively testing, ie. not failed and waiting at cleanup stage.

 

Thanks & Regards,

Shane.

0 Kudos
Message 1 of 7
(4,761 Views)

Shane,

 

it is not possible to reduce the number of threads the rendezvous is going to wait for dynamically.

So it depends on where you create the rendezvous if your idea works out. When creating the rendezvous in the cleanup itself, it might work.... otherwise, you will create a deadlock.

 

You can get information on the SequenceFailed status using each execution context (ThisContext). It is not very easy to do so if you never done something similar.... therefore, i recommend you to reconcider the whole approach because even when done properly, it is possible (though not likely) that you are going to create a deadlock....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 7
(4,748 Views)

Hi,

  you need to do an iterative approach to see if the test socket is active based on a point before you set the number of threads to wait for with the rendezvous - Runstate.TestSockets.Count contains a number that says how many are available (enabled and disabled) and then the list (array) of all the testsockets is in Runstate.root.Parameters.ModelData.TestSockets[x] and you're looking for the disabled item in there.

So for each in Runstate.Root.Parameters.TestSockets[item].Disabled count the number of falses and use that for the number of rendezvous threads to setup.

Of course, as the previous poster noted - this doesn't help if you've already committed to a number of rendezvous threads and you're finding you're skipping over a rendezvous step.

Options here are to look at the top level again, and if there's a step going through cleanup because it failed, then that's a pre-condition on the rendezvous step, but that would prevent all instances of that front levelling up.#

You could pre-create 4 rendezvous items though - a wait for 1, wait for 2, wait for 3 and wait for 4. Then use the flags to select which one things need ot wiat on.

Again - that doesn't help if say 2 are already waiting and a third one suddenly goes to failure so skips ove the "wait for 3" rendezvous.

 

Within reason, you should have an idea how long a rendezvous takes anyway - use the timeout on the rendezvous step so it will drop out if there's one missing.

 

That help?

 

Thanks

Sacha

// it takes almost no time to rate an answer Smiley Wink
Message 3 of 7
(4,740 Views)

If you are using the batch model you should generally not be using rendezvous. You should use batch synchronization instead. Batch synchronization already accounts for active threads so there is no need to track anything. Also batch synchronization behaves like a rendezvous automatically at the beginning and end of each section for all active testsocket executions.

 

One of the main benefits of the batch model is batch synchronization and it sounds like it is exactly what you need in this case.

 

-Doug

0 Kudos
Message 4 of 7
(4,729 Views)

Since it is the BatchModel, couldn't you set the Step Synchronization to Parallel which means all threads enter at the same time?  This would use the Model to create a "Rendevous", instead of inserting a rendevous step, and if a thread fails/terminates it takes care of it in the model.

0 Kudos
Message 5 of 7
(4,723 Views)

@jhedr wrote:

Since it is the BatchModel, couldn't you set the Step Synchronization to Parallel which means all threads enter at the same time?  This would use the Model to create a "Rendevous", instead of inserting a rendevous step, and if a thread fails/terminates it takes care of it in the model.


Exactly :). This is batch synchronization. You can also use the batch synchronization step type to create a section containing more than one step, though it's probably not necessary in your use case if you just want something that acts as a rendezvous. Just create a none-adapter action step and set its batch sync setting to parallel and it will act likely a managed rendezvous when used with the batch model.

 

-Doug

0 Kudos
Message 6 of 7
(4,718 Views)

Hi,

Many thanks for tall the suggestions.

Seems like the easiest thing to do is use the batch synch as suggested to act as a rendezvous...

 

Regards,

Shane.

0 Kudos
Message 7 of 7
(4,701 Views)