Skip to content
Snippets Groups Projects
Commit 55431da1 authored by BRONES Romain's avatar BRONES Romain
Browse files

[ContextSaver] Switch to batch attribute access

Do not loop access on tango devices, use group access.
parent 0c28affd
No related branches found
No related tags found
No related merge requests found
...@@ -31,27 +31,36 @@ def get_wattr(proxy): ...@@ -31,27 +31,36 @@ def get_wattr(proxy):
logger.debug("Scanning write attribute of device %s"%proxy.name()) logger.debug("Scanning write attribute of device %s"%proxy.name())
config = dict() config = dict()
# Scan all attributes # Get all attributes configuration
for attr in proxy.get_attribute_list(): cattr = proxy.get_attribute_config(proxy.get_attribute_list())
wattr=[]
for attr in cattr:
logger.debug("Analyse attribute '%s' "%( logger.debug("Analyse attribute '%s' "%(
attr)) attr.name))
try: if attr.writable in [
if proxy.get_attribute_config(attr).writable in [
tango.AttrWriteType.WRITE, tango.AttrWriteType.WRITE,
tango.AttrWriteType.READ_WRITE, tango.AttrWriteType.READ_WRITE,
tango.AttrWriteType.READ_WITH_WRITE]: tango.AttrWriteType.READ_WITH_WRITE]:
v= proxy[attr].value
if type(v) is numpy.ndarray:
v=v.tolist()
config[attr]=v # attr is writtable, savbing it into list
wattr.append(attr.name)
logger.debug("Detect writtable attribute '%s' = %s"%( logger.debug("Detect writtable attribute '%s'"%(
attr, attr.name))
proxy[attr].value))
except tango.DevFailed: # Read all writtable attributes
logger.warning("Failed to save attribute '%s'"%attr) rattr = proxy.read_attributes(wattr)
for attr in rattr:
v= attr.value
if type(v) is numpy.ndarray:
v=v.tolist()
logger.debug("Read writtable attribute '%s' = %s"%(
attr.name,
v))
config[attr.name]=v
return config return config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment