executor

package
v2.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2021 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Deer executor * (C) 2019 LanceLRQ

Deer executor * (C) 2019-Now LanceLRQ

Index

Constants

View Source
const (
	ITimerReal    = 0
	ITimerVirtual = 1
	ITimerVProf   = 2
)

定义ITimer的常量,命名规则遵循Linux的原始设定

Variables

View Source
var CommonEnvs = []string{"PYTHONIOENCODING=utf-8"}

定义公共环境变量

Functions

func CheckRequireFilesExists

func CheckRequireFilesExists(config *commonStructs.JudgeConfiguration, configDir string) error

检查配置文件里的所有文件是否存在

func CompileSpecialJudgeCodeFile

func CompileSpecialJudgeCodeFile(source, name, binRoot, configDir, libraryDir, lang string) (string, error)

普通特殊评测的编译方法

func GetOrCreateBinaryRoot

func GetOrCreateBinaryRoot(config *commonStructs.JudgeConfiguration) (string, error)

获取二进制文件的目录

func Max

func Max(x, y int64) int64

func Max32

func Max32(a, b int) int

func OpenFile

func OpenFile(filePath string, flag int, perm os.FileMode) (*os.File, error)

打开文件并获取描述符 (强制文件检查)

Types

type ITimerVal

type ITimerVal struct {
	ItInterval TimeVal
	ItValue    TimeVal
}

type JudgeSession

type JudgeSession struct {
	SessionId    string   // Judge Session Id
	SessionRoot  string   // Session Root Directory
	SessionDir   string   // Session Directory
	ConfigFile   string   // Config file
	ConfigDir    string   // Config file dir
	CodeLangName string   // Code file language name
	CodeFile     string   // Code File Path
	LibraryDir   string   // Compile Library Path for Working Program
	Commands     []string // Executable program commands

	JudgeConfig commonStructs.JudgeConfiguration      // Judge Configurations
	Compiler    provider.CodeCompileProviderInterface // Compiler entity

	Logger *logger.JudgeLogger // Judge Logger
}

评测会话类

func NewSession

func NewSession(configFile string) (*JudgeSession, error)

创建会话对象

func NewSessionWithLog

func NewSessionWithLog(configFile string, print bool, level int) (*JudgeSession, error)

创建一个包含日志的对象

func (*JudgeSession) Clean

func (session *JudgeSession) Clean()

清理案发现场

func (*JudgeSession) DiffText

func (session *JudgeSession) DiffText(result *commonStructs.TestCaseResult) error

进行文本比较 Compare the text

func (*JudgeSession) GetCompiler

func (session *JudgeSession) GetCompiler(codeStr string) (provider.CodeCompileProviderInterface, error)

编译文件 如果不设置codeStr,默认会读取配置文件里的code_file字段并打开对应文件

func (*JudgeSession) JudgeOnce

func (session *JudgeSession) JudgeOnce(judgeResult *commonStructs.TestCaseResult)

基于JudgeOptions进行评测调度

func (*JudgeSession) RunJudge

func (session *JudgeSession) RunJudge() commonStructs.JudgeResult

执行评测

func (*JudgeSession) SaveConfiguration

func (session *JudgeSession) SaveConfiguration(userConfirm bool) error

保存评测会话

type ProcessInfo

type ProcessInfo struct {
	Pid    uintptr            `json:"pid"`
	Status syscall.WaitStatus `json:"status"`
	Rusage syscall.Rusage     `json:"rusage"`
}

进程信息

type RLimit

type RLimit struct {
	Which int
	RLim  syscall.Rlimit
}

type TimeVal

type TimeVal struct {
	TvSec  uint64
	TvUsec uint64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL