def run_prehooks(self): if self.prehooks is not None: LOG.log( PLUMBER_LOGS, wrap_in_dividers("Running prehooks for {}".format( self.config[ID]), divider_char='-')) super(PlumberPipe, self).run_prehooks()
def run_posthooks(self, last_result): if self.posthooks_execute and ( self.posthooks is not None or (last_result == SUCCESS and self.posthooks_success is not None) or (last_result == FAILURE and self.posthooks_failure is not None)): LOG.log( PLUMBER_LOGS, wrap_in_dividers("Running global posthooks", divider_char='-')) super(PlumberPlanner, self).run_posthooks(last_result)
def run_posthooks(self, last_result): if self.posthooks is not None or ( last_result == SUCCESS and self.posthooks_success is not None) or (last_result == FAILURE and self.posthooks_failure is not None): LOG.log( PLUMBER_LOGS, wrap_in_dividers("Running posthooks for {}".format( self.config[ID]), divider_char='-')) super(PlumberPipe, self).run_posthooks(last_result)
def save_new_checkpoint(current_result): LOG.log(PLUMBER_LOGS, wrap_in_dividers('Checkpointing')) if checkpoint and contains_activity( self.results) and current_result == SUCCESS or ( current_result == FAILURE and self.checkpoint_unit == PIPE): LOG.log(PLUMBER_LOGS, 'Changes performed, persisting a new checkpoint...') self.checkpoint_store.save_data( self.current_checkpoint, create_execution_report(self.results, gitmojis=True)) else: LOG.log( PLUMBER_LOGS, 'Skip checkpointing due to inactivity, error or disabling')
def main_execution_logic(): if self.pipes is None: raise ExecutionFailure('No pipes configured') self.results = [{ ID: pipe.config[ID], STATUS: UNKNOWN, PIPE: pipe } for pipe in self.pipes] for item in self.results: LOG.log( PLUMBER_LOGS, wrap_in_dividers('Pipe evaluation for [{}]'.format( item[ID]))) def pipe_execution_logic(): if item[PIPE].evaluate(): self.posthooks_execute = True item[STATUS] = DETECTED LOG.log( PLUMBER_LOGS, 'Detected change on pipe {}, starting execution'. format(item[ID])) item[PIPE].execute() LOG.log(PLUMBER_LOGS, 'Steps for pipe {} executed'.format(item[ID])) item[STATUS] = EXECUTED else: LOG.log( PLUMBER_LOGS, 'No change detected on pipe {}. Moving on'.format( item[ID])) item[STATUS] = NOT_DETECTED if item[STATUS] != NOT_DETECTED: checkpoint = item[PIPE].get_new_checkpoint() if checkpoint is not None: self.current_checkpoint[ item[PIPE].config[ID]] = checkpoint try: item[PIPE].wrap_in_hooks(pipe_execution_logic)() except Exception as e: item[STATUS] = FAILED raise e return self.results
def run_prehooks(self): if self.prehooks is not None: LOG.log( PLUMBER_LOGS, wrap_in_dividers("Running global prehooks", divider_char='-')) super(PlumberPlanner, self).run_prehooks()