Now that system.tag.getAlarmStates is gone, what is the most efficient way to get a complete list of alarms for a large number of tags (350k)?
My estimates using a combination of system.tag.browse, system.tag.getConfiguration, and system.tag.readBlocking puts it at ~9hrs of runtime. But I don't know if I have any other option
I’ve found a way that worked for me. Alarm evaluation must be disabled for those tags that do not have alarms (which could be feasible to do for a large amount of tags if UDTs have been used).
tags = system.tag.browse("[default]SCP", {"recursive":True}).getResults()
for tag in tags:
stringPath = str(tag['fullPath'])
if system.tag.readBlocking(stringPath+".AlarmEvalEnabled")[0].value:
if system.tag.readBlocking(stringPath+".OpcItemPath")[0].value != "":
print system.tag.readBlocking(stringPath+".OpcItemPath")[0].value
Actually, you can just check the attributes key values for alarms directly from the browse results. You also don’t need to call getResult; you get the same results from the return ofthe browse function. Also reading one tag at a time will be extremely slow especially for large numbers of tags. You should always bulk read and write tags