diff --git a/FofbTool/Configuration.py b/FofbTool/Configuration.py index f371cdf058e1f5f4792efbeb87e667a05c67b1f7..cea7fef71933f6162fc4802f0c605292895ff4a3 100644 --- a/FofbTool/Configuration.py +++ b/FofbTool/Configuration.py @@ -18,7 +18,7 @@ logger = logging.getLogger("FofbTool") def trycatch_tango_devfailed(func): def inner_function(*args, **kwargs): try: - func(*args, **kwargs) + return func(*args, **kwargs) except tango.DevFailed as e: logger.error("DevFailed met during configuration") logger.debug(e) diff --git a/FofbTool/Operation.py b/FofbTool/Operation.py index 1a57bff72929080ad6eef4456ec0074ccce436a4..d734b298a3b5a908e78908476b76c7d401c4c883 100644 --- a/FofbTool/Operation.py +++ b/FofbTool/Operation.py @@ -19,7 +19,7 @@ logger = logging.getLogger("FofbTool") def trycatch_tango_devfailed(func): def inner_function(*args, **kwargs): try: - func(*args, **kwargs) + return func(*args, **kwargs) except tango.DevFailed as e: logger.error("DevFailed met during operation") logger.debug(e) @@ -155,6 +155,8 @@ def stop_ccn(node_tangopath, ccnif=[]): prx["ccnpack{}_control".format(n)] = False prx["ccnunpack{}_control".format(n)] = False + return True + @trycatch_tango_devfailed def reset_ccn(node_tangopath, ccnif=[]): """ @@ -196,6 +198,8 @@ def reset_ccn(node_tangopath, ccnif=[]): ack_ccn(node_tangopath, ccnif) + return True + @trycatch_tango_devfailed def start_ccn(node_tangopath, ccnif=[]): """ @@ -235,6 +239,8 @@ def start_ccn(node_tangopath, ccnif=[]): prx["ccnpack{}_control".format(n)] = 1 prx["ccnunpack{}_control".format(n)] = 1 + return True + @trycatch_tango_devfailed def ack_ccn(node_tangopath, ccnif=[]): """ @@ -273,6 +279,8 @@ def ack_ccn(node_tangopath, ccnif=[]): prx["ccnpack{}_reset_error".format(n)] = False prx["ccnunpack{}_reset_error".format(n)] = False + return True + ################################################################################################### # OPERATIONS ON COMBPM ################################################################################################### @@ -302,6 +310,8 @@ def stop_combpm(node_tangopath): prx["combpm_reset"] = 1 prx["combpm_gt_control"] = 0x5 + return True + @trycatch_tango_devfailed def start_combpm(node_tangopath): """ @@ -321,7 +331,7 @@ def start_combpm(node_tangopath): prx.ping() except tango.DevFailed: logger.error("Failed to obtain tango proxy or to ping to {}".format(node_tangopath)) - return None + return False logger.info("Starting ComBpm on {}".format(node_tangopath)) prx["combpm_reset"] = 0 @@ -329,6 +339,7 @@ def start_combpm(node_tangopath): time.sleep(1) ack_combpm(node_tangopath) + return True @trycatch_tango_devfailed def ack_combpm(node_tangopath): @@ -356,6 +367,7 @@ def ack_combpm(node_tangopath): time.sleep(1) prx["combpm_reset_error"] = False + return True ################################################################################################### # OPERATIONS ON COMLBP @@ -389,6 +401,8 @@ def stop_comlbp(node_tangopath): for n in range(4): prx["comlbp{}_control".format(n)] = 0 + return True + @trycatch_tango_devfailed def start_comlbp(node_tangopath): """ @@ -414,6 +428,8 @@ def start_comlbp(node_tangopath): for n in range(4): prx["comlbp{}_control".format(n)] = 0x10 + return True + @trycatch_tango_devfailed def reset_comlbp(node_tangopath): @@ -444,6 +460,7 @@ def reset_comlbp(node_tangopath): for n in range(4): prx["comlbp{}_control".format(n)] = 0x0 + return True ###################################################################################################