def failure(self, job, opts, itemid): """Count failure as NOOK like an error at execution.""" self.nbnook[opts['threadid']] += 1 res = ['<F>_NOT_RUN', 0., 0., 0., 0.] result = [job, opts] result.extend(res) line = self.summary_line(job, opts, res) add_to_tail(self.resutest, line, filename='NOOK') add_to_tail(self.resutest, line, filename='RESULTAT') result.append('failure') return result
def ended(self, job, opts, itemid, calcul, res): """Call when a job is ended. """ line = self.summary_line(job, opts, res) print3(line) add_to_tail(self.reptrav, line) # count nook for each thread gravity = self.run.GetGrav(calcul.diag) if gravity == -9 or gravity >= self.run.GetGrav('NOOK'): self.nbnook[opts['threadid']] += 1 output_filename = _(u'no error or flashdir not defined') # copy output/error to flashdir fflash = calcul.copy_flash() output_filename = fflash['output'].repr() result = [job, opts] result.extend(res) result.append(output_filename) # clean flasheur calcul.kill() return result
def get_calcul_state(self, calcul): """Function to retreive the state of a calculation.""" etat, diag, output = calcul.tail(nbline=5) if etat != 'ENDED': self.run.Mess( ufmt(_(u"job status is %-6s on %s"), etat, calcul.host), 'SILENT') txt = [line for line in output.splitlines() \ if line.strip() != '' and (not line.strip().startswith('JOB=')) \ and (not line.strip().startswith('<INFO>')) ] txt = os.linesep.join(txt).strip() if etat != 'PEND' and txt != '': txt = indent(txt, "%s: " % calcul.host) add_to_tail(self.reptrav, txt) print3(txt) etat = calcul.get_state()[0] if not calcul.is_ended(): dt = time.time() - calcul.start_time if dt > self.run_timeout > 0: self._mess_running_timeout(dt, self.run_timeout, calcul.name) return etat
def ended(self, job, opts, itemid, calcul, res): """Call when a job is ended.""" line = self.summary_line(job, opts, res) # printing line is not thread safe but it's only printing! print3(line) add_to_tail(self.reptrav, line) # count nook for each thread gravity = self.run.GetGrav(calcul.diag) error = gravity == -9 or gravity >= self.run.GetGrav('NOOK') if error: self.nbnook[opts['threadid']] += 1 add_to_tail(self.resudir, line, filename='NOOK') add_to_tail(self.resudir, line, filename='RESULTAT') output_filename = _(u'no error or flashdir not defined') # copy output/error to flashdir if self.flashdir != None: try: if not osp.isdir(self.flashdir): self.run.MkDir(self.flashdir, niverr='SILENT') except OSError: pass self.run.Copy(self.flashdir, calcul.flash('output'), calcul.flash('error'), calcul.flash('export'), niverr='<A>_ALARM') output_filename = osp.join(self.flashdir, osp.basename(calcul.flash('output'))) result = [job, opts] result.extend(res) result.append(output_filename) # clean flasheur calcul.kill() return result