executor

package
v2.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

ExtraEnviron 额外需要被注入的环境变量

Functions

func CheckRequireFilesExists

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

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

func CompileSpecialJudgeCodeFile

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

CompileSpecialJudgeCodeFile 普通特殊评测的编译方法

func GetOrCreateBinaryRoot

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

GetOrCreateBinaryRoot 获取二进制文件的目录

func Max

func Max(x, y int64) int64

Max find max between x & y

func Max32

func Max32(a, b int) int

Max32 find max between a & b

Types

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
	Timeout int                 // Process timeout (s)
}

JudgeSession 评测会话类

func NewSession

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

NewSession 创建会话对象

func NewSessionWithLog

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

NewSessionWithLog 创建一个包含日志的对象

func (*JudgeSession) Clean

func (session *JudgeSession) Clean()

Clean 清理会话工作目录

func (*JudgeSession) DiffText

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

DiffText Compare the text 进行文本比较

func (*JudgeSession) GetCompiler

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

GetCompiler get a compiler provider from session.CodeLangName 如果不设置codeStr,默认会读取配置文件里的code_file字段并打开对应文件

func (*JudgeSession) JudgeOnce

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

JudgeOnce 基于JudgeOptions进行评测调度

func (*JudgeSession) RunJudge

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

RunJudge 执行评测

func (*JudgeSession) SaveConfiguration

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

SaveConfiguration 保存评测会话

type PArgs added in v2.2.0

type PArgs struct {
	Name string
	Args []string
	Attr *cmd.ProcAttr
}

PArgs Start Process Arguments

type ProcessInfo

type ProcessInfo struct {
	Pid     int                `json:"pid"`
	Process *cmd.Process       `json:"-"`
	Status  syscall.WaitStatus `json:"status"`
	Rusage  *syscall.Rusage    `json:"rusage"`
}

ProcessInfo 进程信息

Jump to

Keyboard shortcuts

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