def after_execution(self, exitcode, forceTimeout=False, termination_reason=None): """ @deprecated: use set_result() instead """ # termination reason is not fully precise for timeouts, so we guess "timeouts" # if time is too high isTimeout = forceTimeout \ or termination_reason in ['cputime', 'cputime-soft', 'walltime'] \ or self._is_timeout() if isinstance(exitcode, int): exitcode = util.ProcessExitCode.from_raw(exitcode) # read output try: with open(self.log_file, 'rt', errors='ignore') as outputFile: output = outputFile.readlines() # first 6 lines are for logging, rest is output of subprocess, see runexecutor.py for details output = output[6:] except IOError as e: logging.warning("Cannot read log file: %s", e.strerror) output = [] self.status = self._analyze_result(exitcode, output, isTimeout, termination_reason) self.category = result.get_result_category(self.expected_results, self.status, self.properties) for column in self.columns: substitutedColumnText = substitute_vars([column.text], self.runSet, self.sourcefiles[0])[0] column.value = self.runSet.benchmark.tool.get_value_from_output(output, substitutedColumnText)
def after_execution(self, exitcode, forceTimeout=False, termination_reason=None): """ @deprecated: use set_result() instead """ # termination reason is not fully precise for timeouts, so we guess "timeouts" # if time is too high isTimeout = forceTimeout or termination_reason in ["cputime", "cputime-soft", "walltime"] or self._is_timeout() if isinstance(exitcode, int): exitcode = util.ProcessExitCode.from_raw(exitcode) # read output try: with open(self.log_file, "rt", errors="ignore") as outputFile: output = outputFile.readlines() # first 6 lines are for logging, rest is output of subprocess, see runexecutor.py for details output = output[6:] except IOError as e: logging.warning("Cannot read log file: %s", e.strerror) output = [] self.status = self._analyse_result(exitcode, output, isTimeout, termination_reason) self.category = result.get_result_category(self.identifier, self.status, self.properties) for column in self.columns: substitutedColumnText = substitute_vars([column.text], self.runSet, self.sourcefiles[0])[0] column.value = self.runSet.benchmark.tool.get_value_from_output(output, substitutedColumnText)
def set_result(self, values, visible_columns={}): """Set the result of this run. @param values: a dictionary with result values as returned by RunExecutor.execute_run(), may also contain arbitrary additional values @param visible_columns: a set of keys of values that should be visible by default (i.e., not marked as hidden), apart from those that BenchExec shows by default anyway """ exitcode = values.pop("exitcode", None) if exitcode is not None: if exitcode.signal: self.values["@exitsignal"] = exitcode.signal else: self.values["@returnvalue"] = exitcode.value for key, value in values.items(): if key == "cpuenergy" and not isinstance(value, (str, bytes)): energy = intel_cpu_energy.format_energy_results(value) for energy_key, energy_value in energy.items(): if energy_key != "cpuenergy": energy_key = "@" + energy_key self.values[energy_key] = energy_value elif key in ["walltime", "cputime", "memory", "cpuenergy"]: self.values[key] = value elif key in visible_columns: self.values[key] = value else: self.values["@" + key] = value termination_reason = values.get("terminationreason") # Termination reason was not fully precise for timeouts, so we guess "timeouts" # if time is too high. Since removal of ulimit time limit this should not be # necessary, but also does not harm. We might reconsider this in the future. isTimeout = (termination_reason in ["cputime", "cputime-soft", "walltime"] or self._is_timeout()) # read output try: with open(self.log_file, "rt", errors="ignore") as outputFile: output = outputFile.readlines() # first 6 lines are for logging, rest is output of subprocess, see runexecutor.py for details output = output[6:] except OSError as e: logging.warning("Cannot read log file: %s", e.strerror) output = [] self.status = self._analyze_result(exitcode, output, isTimeout, termination_reason) self.category = result.get_result_category(self.expected_results, self.status, self.properties) for column in self.columns: substitutedColumnText = substitute_vars([column.text], self.runSet, self.sourcefiles[0])[0] column.value = self.runSet.benchmark.tool.get_value_from_output( output, substitutedColumnText)
def after_execution(self, returnvalue, forceTimeout=False, termination_reason=None): # termination reason is not fully precise for timeouts, so we guess "timeouts" # if time is too high isTimeout = forceTimeout \ or termination_reason in ['cputime', 'cputime-soft', 'walltime'] \ or self._is_timeout() # read output try: with open(self.log_file, 'rt') as outputFile: output = outputFile.readlines() # first 6 lines are for logging, rest is output of subprocess, see runexecutor.py for details output = output[6:] except IOError as e: logging.warning("Cannot read log file: %s", e.strerror) output = [] self.status = self._analyse_result(returnvalue, output, isTimeout, termination_reason) self.category = result.get_result_category(self.identifier, self.status, self.properties) for column in self.columns: substitutedColumnText = substitute_vars([column.text], self.runSet, self.sourcefiles[0])[0] column.value = self.runSet.benchmark.tool.get_value_from_output(output, substitutedColumnText)