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):
logger.debug("Scanning write attribute of device %s"%proxy.name())
config = dict()
# Scan all attributes
for attr in proxy.get_attribute_list():
# Get all attributes configuration
cattr = proxy.get_attribute_config(proxy.get_attribute_list())
wattr=[]
for attr in cattr:
logger.debug("Analyse attribute '%s' "%(
attr))
attr.name))
try:
if proxy.get_attribute_config(attr).writable in [
if attr.writable in [
tango.AttrWriteType.WRITE,
tango.AttrWriteType.READ_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"%(
attr,
proxy[attr].value))
except tango.DevFailed:
logger.warning("Failed to save attribute '%s'"%attr)
logger.debug("Detect writtable attribute '%s'"%(
attr.name))
# Read all writtable attributes
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
......
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