02-10-2013 02:12 PM
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.
02-11-2013 04:07 AM
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
02-11-2013 07:19 AM - edited 02-11-2013 07:25 AM
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
02-11-2013 09:25 AM - edited 02-11-2013 09:27 AM
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
02-11-2013 09:51 AM
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.
02-11-2013 10:08 AM
@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
02-12-2013 02:50 AM
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.