judge

package
v0.0.0-...-699dfa3 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: MIT Imports: 1 Imported by: 6

Documentation

Index

Constants

View Source
const (
	INNER_COMPILER_ERR = 1101 // error from real compiler
	OUTER_COMPILER_ERR = 1102 // error from our outer compiler
	COMPILE_TIMEOUT    = 1103
)

11xx: compile error

View Source
const (
	// 12xx: error from outermost process (the process to start container)
	RUNNER_ERR = 1201

	// 13xx: container error (error from container)
	CONTAINER_ERR = 1301

	// 14xx: run error (error from program run in container)
	APP_ERR                   = 1401
	WRONG_ANSWER_ERR          = 1402
	OUT_OF_MEMORY_ERR         = 1403
	RUN_TIMEOUT_ERR           = 1404
	BAD_SYSTEMCALL_ERR        = 1405
	NO_ENOUGH_PID_ERR         = 1406
	JAVA_SECURITY_MANAGER_ERR = 1407
)

1[2-4]xx: container error

View Source
const (
	CompileResType = "COMPILE"
	RunResType     = "RUN"
)
View Source
const (
	SUCCESS = int64(iota)
	FAIL
)

Variables

View Source
var (
	AcceptedStatus = Status{
		Code: 0,
		Msg:  "Accepted",
	}
	JudgingStatus = Status{
		Code: 1,
		Msg:  "Judging",
	}
	RuntimeErrorStatus = Status{
		Code: 2,
		Msg:  "RuntimeError",
	}
	CompileErrorStatus = Status{
		Code: 3,
		Msg:  "CompileError",
	}
	RunTimeOutStatus = Status{
		Code: 4,
		Msg:  "RunTimeOut",
	}
	OOMStatus = Status{
		Code: 5,
		Msg:  "OOM",
	}
	WrongAnswerStatus = Status{
		Code: 6,
		Msg:  "WrongAnswer",
	}
	SystemErrorStatus = Status{
		Code: 7,
		Msg:  "SystemError",
	}
	NullStatus = Status{
		Code: -1,
		Msg:  "",
	}
)

Functions

func GetInnerErrorMsgByErrNo

func GetInnerErrorMsgByErrNo(errno int64) string

return empty string when don't exist

func GetOuterErrorMsgByErrNo

func GetOuterErrorMsgByErrNo(errno int64) string

return empty string when don't exist

Types

type InnerResult

type InnerResult struct {
	// for compile result and run result
	ID         string `json:"id"`
	ResultType string `json:"resType"`
	Status     int64  `json:"status"`
	Errno      int64  `json:"errno,omitempty"`
	Message    string `json:"msg,omitempty"`
	StdErr     string `json:"stderr,omitempty"`    // stderr from inner process
	TimeLimit  int64  `json:"timelimit,omitempty"` // time limit in ms

	// only for run result
	Runtime  int64  `json:"runtime,omitempty"`  // time usage in ms
	Memory   int64  `json:"memory,omitempty"`   // memory usage in KB
	MemLimit int64  `json:"memlimit,omitempty"` // memory limit in KB
	Input    string `json:"input,omitempty"`
	Output   string `json:"output,omitempty"`
	Expected string `json:"expected,omitempty"`
}

result struct in inner system

func (InnerResult) ToOuterResult

func (i InnerResult) ToOuterResult() OuterResult

type Message

type Message map[string]string

type OuterResult

type OuterResult struct {
	// for compile result and run result
	ID        string `json:"id"`
	Status    Status `json:"status"`
	Message   string `json:"msg,omitempty"`
	StdErr    string `json:"stderr,omitempty"`    // stderr from inner process
	TimeLimit int64  `json:"timelimit,omitempty"` // time limit in ms

	// only for run result
	Runtime         int64  `json:"runtime"`            // time usage in ms
	Memory          int64  `json:"memory"`             // memory usage in KB
	MemLimit        int64  `json:"memlimit,omitempty"` // memory limit in KB
	Input           string `json:"input,omitempty"`
	Output          string `json:"output,omitempty"`
	Expected        string `json:"expected,omitempty"`
	TestCaseNum     int    `json:"test_case_num"`
	SuccessTestCase int    `json:"success_test_case"`

	//
	IsComplete bool `json:"iscomplete"`
}

the result expose to user

type Status

type Status struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

func GetStatusByErrNo

func GetStatusByErrNo(errno int64) Status

return empty status when don't exist

Jump to

Keyboard shortcuts

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