def pre_exec(self): """ Do this before entering the GuardState. """ # close all streams try: injtools.close_all_streams(hwinj_list) except: etype, val, tb = sys.exc_info() ftb = traceback.format_tb(tb) for line in ftb: log(line) log(str(etype) + " " + str(val)) return "FAILURE_TO_KILL_STREAM"
def pre_exec(self): """ Do this before entering the GuardState. """ # check if external alert within exttrig_wait_seconds seconds # in the past exttrig_alert_time = injtools.check_exttrig_alert(exttrig_channel_name, exttrig_wait_seconds) if exttrig_alert_time: # if there is an external alert then close all streams try: injtools.close_all_streams(hwinj_list) except: etype, val, tb = sys.exc_info() ftb = traceback.format_tb(tb) for line in ftb: log(line) log(str(etype) + " " + str(val)) return "FAILURE_TO_KILL_STREAM" return failure_state
def pre_exec(self): """ Do this before entering the GuardState. """ # check if external alert within exttrig_wait_seconds seconds # in the past exttrig_alert_time = injtools.check_exttrig_alert( exttrig_channel_name, exttrig_wait_seconds) if exttrig_alert_time: # if there is an external alert then close all streams try: injtools.close_all_streams(hwinj_list) except: etype, val, tb = sys.exc_info() ftb = traceback.format_tb(tb) for line in ftb: log(line) log(str(etype) + " " + str(val)) return "FAILURE_TO_KILL_STREAM" return failure_state