Example #1
0
 def execute(self):
     """
     Run the execution
     """
     self.time_ref.reset()
     LOGGER.info(None, extra=self.log_dict)
     return True
Example #2
0
 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()
Example #3
0
 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()
Example #4
0
 def execute(self):
     """
     Run the execution
     """
     self.time_ref.reset()
     LOGGER.info(None, extra=self.log_dict)
     return True
Example #5
0
def stream_sequence_logs(stream, debug_level=logging.INFO):
    """
    Add the custom stream handler to the execution logger
    """
    handler = logging.StreamHandler(stream)
    handler.setFormatter(SequenceLoggingFormatter())
    handler.setLevel(debug_level)
    LOGGER.addHandler(handler)
Example #6
0
def stream_sequence_logs(stream, debug_level=logging.INFO):
    """
    Add the custom stream handler to the execution logger
    """
    handler = logging.StreamHandler(stream)
    handler.setFormatter(SequenceLoggingFormatter())
    handler.setLevel(debug_level)
    LOGGER.addHandler(handler)
Example #7
0
 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
Example #8
0
 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
Example #9
0
 def wrapper(self, *args, **kwargs):
     LOGGER.debug(BES.BG, extra=self.log_dict)
     res = f(self, *args, **kwargs)
     if res:
         LOGGER.debug(BES.OK, extra=self.log_dict)
     else:
         LOGGER.debug(BES.KO, extra=self.log_dict)
     return res
Example #10
0
 def wrapper(self, *args, **kwargs):
     LOGGER.debug(BES.BG, extra=self.log_dict)
     res = f(self, *args, **kwargs)
     if res:
         LOGGER.debug(BES.OK, extra=self.log_dict)
     else:
         LOGGER.debug(BES.KO, extra=self.log_dict)
     return res
Example #11
0
 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
Example #12
0
 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
Example #13
0
 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
Example #14
0
 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
Example #15
0
 def critical(self, msg):
     """ Logging method with critical level """
     LOGGER.critical(msg, extra=self._log_dict)
Example #16
0
 def error(self, msg):
     """ Logging method with error level """
     LOGGER.error(msg, extra=self._log_dict)
Example #17
0
 def warning(self, msg):
     """ Logging method with warning level """
     LOGGER.warning(msg, extra=self._log_dict)
Example #18
0
 def info(self, msg):
     """ Logging method with info level """
     LOGGER.info(msg, extra=self._log_dict)
Example #19
0
 def debug(self, msg):
     """ Logging method with debug level """
     LOGGER.debug(msg, extra=self._log_dict)
Example #20
0
 def debug(self, msg):
     """ Logging method with debug level """
     LOGGER.debug(msg, extra=self._log_dict)
Example #21
0
 def info(self, msg):
     """ Logging method with info level """
     LOGGER.info(msg, extra=self._log_dict)
Example #22
0
 def error(self, msg):
     """ Logging method with error level """
     LOGGER.error(msg, extra=self._log_dict)
Example #23
0
 def warning(self, msg):
     """ Logging method with warning level """
     LOGGER.warning(msg, extra=self._log_dict)
Example #24
0
 def execute(self):
     """
     Method to override
     """
     LOGGER.info(None, extra=self.log_dict)
     return True
Example #25
0
 def critical(self, msg):
     """ Logging method with critical level """
     LOGGER.critical(msg, extra=self._log_dict)
Example #26
0
def add_log_handler(handler):
    """
    Add a log handler to the execution logger
    """
    LOGGER.addHandler(handler)
Example #27
0
def add_log_handler(handler):
    """
    Add a log handler to the execution logger
    """
    LOGGER.addHandler(handler)
Example #28
0
 def execute(self):
     """
     Method to override
     """
     LOGGER.info(None, extra=self.log_dict)
     return True