def _handle_error(self, reduction_run: ReductionRun, message: Message, err: Exception): """ Couldn't save the state in the database properly - mark the run as errored. """ err_msg = "Encountered error when saving run variables" message.message = err_msg self._logger.error("%s\n%s", err_msg, str(err)) message.reduction_log = str(err) self.reduction_error(reduction_run, message)
def send_message_onwards(self, reduction_run: ReductionRun, message: Message, instrument: Instrument, software: Software): """ Send the message onwards, either for processing, if validation is OK and instrument isn't paused, otherwiese skips if either of those is true. """ # Activate instrument if script was found skip_reason = self.find_reason_to_skip_run(reduction_run, message, instrument) if skip_reason is not None: message.message = skip_reason message.reduction_log = skip_reason self.reduction_skipped(reduction_run, message) elif message.message: self.reduction_error(reduction_run, message) else: self.activate_db_inst(instrument) self.do_reduction(reduction_run, message, software)