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

fix: Properly fail init() when missing an extractor

* This allow workaround for the missing TDB
parent 3bcc36cc
No related branches found
No related tags found
No related merge requests found
......@@ -45,25 +45,43 @@ def init(
ae._Extractors = (None, None)
ae._AttrTables = (None, None)
_Extr = []
_Attr = []
try:
logger.setLevel(getattr(logging, loglevel.upper()))
except AttributeError:
logger.error("Wrong log level specified: {}".format(loglevel.upper()))
return
logger.debug("Instanciating extractors device proxy...")
ae._Extractors = (tango.DeviceProxy(HdbExtractorPath), tango.DeviceProxy(TdbExtractorPath))
logger.debug("{} and {} instanciated.".format(*ae._Extractors))
for p in [HdbExtractorPath, TdbExtractorPath]:
try:
_Extr.append(tango.DeviceProxy(p))
except tango.DevFailed:
logger.error("Could not find extractor {}".format(p))
return
logger.debug("{} and {} instanciated.".format(*_Extr))
logger.debug("Configuring extractors device proxy...")
for e in ae._Extractors:
for e in _Extr:
# set timeout to 3 sec
e.set_timeout_millis(3000)
logger.debug("Filling attributes lookup tables...")
ae._AttrTables = tuple(e.getattnameall() for e in ae._Extractors)
logger.debug("HDB: {} TDB: {} attributes counted".format(len(ae._AttrTables[0]), len(ae._AttrTables[1])))
for e in _Extr:
try:
_Attr.append(e.getattnameall())
except AttributeError:
logger.error("Could not fetch attributes for extractor {}".format(e))
return
logger.debug("HDB: {} TDB: {} attributes counted".format(len(_Attr[0]), len(_Attr[1])))
ae._Extractors = tuple(_Extr)
ae._AttrTables = tuple(_Attr)
##########################################################################
### Module access functions ###
......
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