def execute(self): """ Run the execution """ self.time_ref.reset() LOGGER.info(None, extra=self.log_dict) return True
def run(self): """ Run the stop mechanism """ # Logging LOGGER.info(None, extra=self.log_dict) # Set all the starters for starter in self.starters: starter.set() # Wait for the execution to finish self.main_thread.runable_sequence_finished.wait() # No backup case if not self.backup_list: return # Sort the backup list key = lambda x: getattr(getattr(x, 'xml_sequence'), 'level') backup_list = list(reversed(sorted(self.backup_list, key=key))) # Link the backup executions first_backup = prev_backup = backup_list[0] for backup in backup_list[1:]: prev_backup.next_execution = backup prev_backup = backup # Run backup first_backup.start() # Wait for backup to finish for backup in backup_list: backup.join()
def execute(self): """ Run the execution """ for thread in self.wait_list: thread.join() if len(self.block.inputs) > 1: msg = "The {} threads have met".format(len(self.block.inputs)) LOGGER.info(msg, extra=self.log_dict) if len(self.block.outputs) > 1: msg = "{} threads have been started".format(len(self.block.outputs)) LOGGER.info(msg, extra=self.log_dict) self.event.set() return True
def execute(self): """ Run the execution """ for thread in self.wait_list: thread.join() if len(self.block.inputs) > 1: msg = "The {} threads have met".format(len(self.block.inputs)) LOGGER.info(msg, extra=self.log_dict) if len(self.block.outputs) > 1: msg = "{} threads have been started".format(len( self.block.outputs)) LOGGER.info(msg, extra=self.log_dict) self.event.set() return True
def execute(self): """ Run the execution """ if self.absolute: msg = 'Wait for t={}s'.format(self.time) LOGGER.info(msg, extra=self.log_dict) self.time_ref.wait(self.time) else : msg = 'Wait {}s'.format(self.time) LOGGER.info(msg, extra=self.log_dict) sleep(self.time) LOGGER.info('Done', extra=self.log_dict) return True
def execute(self): """ Run the execution """ if self.absolute: msg = 'Wait for t={}s'.format(self.time) LOGGER.info(msg, extra=self.log_dict) self.time_ref.wait(self.time) else: msg = 'Wait {}s'.format(self.time) LOGGER.info(msg, extra=self.log_dict) sleep(self.time) LOGGER.info('Done', extra=self.log_dict) return True
def execute(self): """ Run the execution """ if not self.sequences: msg = u"No subsequence to run" LOGGER.info(msg, extra=self.log_dict) return True for i, sequence in enumerate(self.sequences): msg = u"Call : {} ".format(self.sequence_id) if self.iteration > 1: msg += u"(iteration {})".format(i+1) LOGGER.info(msg, extra=self.log_dict) if not sequence.run(): return False if self.tick: msg = 'Tick ({}s)'.format(self.tick) LOGGER.info(msg, extra=self.log_dict) sleep(self.tick) return True
def execute(self): """ Run the execution """ if not self.sequences: msg = u"No subsequence to run" LOGGER.info(msg, extra=self.log_dict) return True for i, sequence in enumerate(self.sequences): msg = u"Call : {} ".format(self.sequence_id) if self.iteration > 1: msg += u"(iteration {})".format(i + 1) LOGGER.info(msg, extra=self.log_dict) if not sequence.run(): return False if self.tick: msg = 'Tick ({}s)'.format(self.tick) LOGGER.info(msg, extra=self.log_dict) sleep(self.tick) return True
def info(self, msg): """ Logging method with info level """ LOGGER.info(msg, extra=self._log_dict)
def execute(self): """ Method to override """ LOGGER.info(None, extra=self.log_dict) return True