def finish_pbs_runtest(job, batch): """ Upon PBS runtest finish determine Job exit :type job: scripts.pbs.job.Job :rtype: ResultParallelThreads """ job.is_active = False try: runner = load_runtest(job.case.fs.dump_output) except: # no output file was generated assuming it went wrong job.status = JobState.EXIT_ERROR Printer.all.err('Job {} ended (no output file found). Case: {}', job, job.full_name) Printer.all.out(' pbs output: ') Printer.all.raw(format_n_lines(IO.read(job.case.fs.pbs_output), False)) return job.status = JobState.EXIT_OK if runner.returncode == 0 else JobState.EXIT_ERROR for thread in runner.threads: StatusPrinter.print_test_result(thread) if thread.returncode != 0 or batch: with Printer.all.with_level(): Printer.all.out('Log file {}', job.case.fs.job_output) Printer.all.raw(format_n_lines(IO.read(job.case.fs.job_output), thread.returncode == 0)) # print status line only if pbs job container more cases if len(runner.threads) > 1: Printer.all.sep() StatusPrinter.print_runner_stat(runner) Printer.all.sep() return runner
def run_local_mode(self): """ Runs this module in local mode. At this point all configuration files has been loaded what is left to do is to prepare execution arguments start whole process """ with printf: runner = ParallelThreads(self.arg_options.parallel) runner.stop_on_error = not self.arg_options.keep_going pypy_index = 1 for yaml_file, yaml_config in list(self.configs.files.items()): for case in yaml_config.get_one(yaml_file): if printf.verbosity() is printf.OutputVerbosity.FULL: printf.out(' - found case {} in {}', case, yaml_file) # create main process which first clean output dir # and then execute test following with comparisons multi_process = self.create_process_from_case(case) multi_process.pypy.extra['runner'] = runner multi_process.pypy.extra['index'] = pypy_index pypy_index += 1 runner.add(multi_process) printf.important('{:16s} {}', 'total cases', runner.total) if printf.verbosity() is printf.OutputVerbosity.FULL: printf.out(' - {:16s} {}', 'includes', self.include) printf.out(' - {:16s} {}', 'excludes', self.exclude) printf.important('cases') with printf: for thread in runner.threads: try: printf.out(' - {}', thread.pypy.case) except: printf.out(' - {}', thread) printf.sep().important('execution:') with printf: # run! runner.start() while runner.is_running(): time.sleep(1) printf.sep().important('SUMMARY ').sep() with printf: for thread in runner.threads: multithread = thread # type: RuntestMultiThread StatusPrinter.print_test_result(multithread) printf.sep() StatusPrinter.print_runner_stat(runner) # exit with runner's exit code GlobalResult.returncode = runner.returncode return runner
def run_local_mode(self): """ Runs this module in local mode. At this point all configuration files has been loaded what is left to do is to prepare execution arguments start whole process """ runner = ParallelThreads(self.arg_options.parallel) runner.stop_on_error = not self.arg_options.keep_going for yaml_file, yaml_config in self.configs.files.items(): for case in yaml_config.get_one(yaml_file): # create main process which first clean output dir # and then execute test following with comparisons multi_process = self.create_process_from_case(case) runner.add(multi_process) if self.include or self.exclude: Printer.all.out('Running {} cases ({}{})'.format( runner.total, 'including only tags in set {} '.format(list(self.include)) if self.include else '', 'excluding all tags in set {}'.format(list(self.exclude)) if self.exclude else '')) else: Printer.all.out('Running {} cases', runner.total) # run! runner.start() while runner.is_running(): time.sleep(1) Printer.all.sep() Printer.all.out('Summary: ') with Printer.all.with_level(1): for thread in runner.threads: multithread = thread """ :type: RuntestMultiThread """ StatusPrinter.print_test_result(multithread) Printer.all.sep() StatusPrinter.print_runner_stat(runner) # exit with runner's exit code GlobalResult.returncode = runner.returncode return runner
def finish_pbs_runtest(job, batch): """ Upon PBS runtest finish determine Job exit :type job: scripts.pbs.job.Job :rtype: ResultParallelThreads """ job.is_active = False try: runner = load_runtest(job.case.fs.dump_output) except: # no output file was generated assuming it went wrong job.status = JobState.EXIT_ERROR Printer.all.err('Job {} ended (no output file found). Case: {}', job, job.full_name) Printer.all.out(' pbs output: ') Printer.all.raw(format_n_lines(IO.read(job.case.fs.pbs_output), False)) return job.status = JobState.EXIT_OK if runner.returncode == 0 else JobState.EXIT_ERROR for thread in runner.threads: StatusPrinter.print_test_result(thread) if thread.returncode != 0 or batch: with Printer.all.with_level(): Printer.all.out('Log file {}', job.case.fs.job_output) Printer.all.raw( format_n_lines(IO.read(job.case.fs.job_output), thread.returncode == 0)) # print status line only if pbs job container more cases if len(runner.threads) > 1: Printer.all.sep() StatusPrinter.print_runner_stat(runner) Printer.all.sep() return runner