Hi,
I'm writing an automation where I need to start a given set of elements that are stopped.
The script needs to wait until all the elements are effectively up and running and not just we triggered their start.
On a first approach, I'm testing the IsActive property but I believe it gets 'true' as soon as we call Start(), thus the method below does not really do what we want.
Do you have any ideas on how to achieve this from my automation script?
ps: the logic for the stopping case will also be requierd, i.e., to wait for all the elements that I called Stop(), are really stopped.
private bool IsAllStarted(Element[] elems)
{
foreach (Element el in elems)
{
if (!engine.FindElement(el.DmaId, el.ElementId).IsActive)
return false;
}
return true;
}
Hi Paulo,
Although the approach of Matthias might work, it uses an SLNET call so we should be cautious when using these. Another option that might be worth mentioning is using the following method Method IsStartupComplete | DataMiner Docs, part of the Skyline.DataMiner.Core.DataMinerSystem namespace (available through a NuGet package).
Kind Regards,
Jarno
Hi Paulo,
I believe there is a way to verify if an element is startup is done completely.
1. Subscribe on the ElementStateEventMessage for each element.
This can be done by creating a subscription with filter 'SubscriptionFilterElement' (for each element).
2. The event message contains 2 properties that you need, the State property and IsElementStartupComplete property.
3. If State is 'Active' + the IsElementStartupComplete property is true, then the correspondent element is ready.
Hope this helps you further
Thanks Matthias, this is a good idea testing the IsElementStartupComplete property, which as Jarno noted, is available through the method IDmsElement.IsStartupComplete()
To complement Jarno’s answer, which I believe it’s the correct approach; IsStartupComplete method is a wrapper for a specific call and you can find additional information about it here: https://docs.dataminer.services/develop/api/NotifyTypes/NT_ELEMENT_STARTUP_COMPLETE.html