當前位置: 首頁>>代碼示例>>Python>>正文


Python Result.r_execution_time方法代碼示例

本文整理匯總了Python中result.Result.r_execution_time方法的典型用法代碼示例。如果您正苦於以下問題:Python Result.r_execution_time方法的具體用法?Python Result.r_execution_time怎麽用?Python Result.r_execution_time使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在result.Result的用法示例。


在下文中一共展示了Result.r_execution_time方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from result import Result [as 別名]
# 或者: from result.Result import r_execution_time [as 別名]

#.........這裏部分代碼省略.........
                                try:
                                    process.kill()
                                except:  # The process might've already exited
                                    pass
                                self.packet_manager.internal_error_packet(problem_id + '\n\n' + traceback.format_exc())
                                return
                            else:
                                process.wait()
                        else:
                            result.result_flag = Result.AC
                            if hasattr(process, 'safe_communicate'):
                                communicate = process.safe_communicate
                            else:
                                communicate = partial(safe_communicate, process)
                            try:
                                result.proc_output, error = communicate(input_data, outlimit=25165824, errlimit=1048576)
                            except OutputLimitExceeded as e:
                                stream, result.proc_output, error = e.args
                                print>> sys.stderr, 'OLE:', stream
                                result.result_flag |= Result.OLE
                                process.kill()
                                process.wait()
                        if error:
                            sys.stderr.write(error)

                        # Must check here because we might be interrupted mid-execution
                        # If we don't bail out, we get an IR.
                        # In Java's case, all the code after this will crash.
                        if self._terminate_grading:
                            raise TerminateGrading()

                        result.max_memory = process.max_memory or 0.0
                        result.execution_time = process.execution_time or 0.0
                        result.r_execution_time = process.r_execution_time or 0.0

                        # C standard checker will crash if not given a string
                        if result.proc_output is None:
                            result.proc_output = ''

                        if interactive:
                            check = CheckerResult(result.result_flag == Result.AC, result.points)
                        else:
                            check = check_func(input_data, result.proc_output, output_data, point_value)
                        if not isinstance(check, CheckerResult):
                            check = CheckerResult(check, check and point_value)
                        if not check.passed:
                            result.result_flag |= Result.WA

                        if not init_data.get('swallow_ir', False) and process.returncode > 0:
                            print>> sys.stderr, 'Exited with error: %d' % process.returncode
                            result.result_flag |= Result.IR
                        if not init_data.get('swallow_rte', False) and process.returncode < 0:
                            if process.returncode is not None:
                                print>> sys.stderr, 'Killed by signal %d' % -process.returncode
                            result.result_flag |= Result.RTE  # Killed by signal
                        if not init_data.get('swallow_tle', False) and process.tle:
                            result.result_flag |= Result.TLE
                        if process.mle:
                            result.result_flag |= Result.MLE

                        if result.result_flag & ~Result.WA:
                            check.points = 0

                        feedback = (check.feedback or
                                    (process.feedback if hasattr(process, 'feedback') else
                                     getattr(executor, 'get_feedback', lambda x, y: '')(error, result)))
開發者ID:rayeya,項目名稱:judge,代碼行數:70,代碼來源:judge.py


注:本文中的result.Result.r_execution_time方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。