judging

package module
v0.0.0-...-a146e0a Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToQueue

func AddToQueue(job JudgeJob)

add a judging job to queue

func JudgeCase

func JudgeCase(batchNum uint64, caseNum uint64, session *shared.JudgeSession, res chan shared.JudgeStatus, batchCase *cache.CachedTestDataCase) pb.TestCaseResult

func StartGrader

func StartGrader(session *GradeSession)

func StartQueueWorker

func StartQueueWorker(num int)

start one worker that will use a thread

func TestSolution

func TestSolution(req *pb.TestSolutionRequest, res chan shared.JudgeStatus, cancelled *bool)

Types

type CaseReturn

type CaseReturn struct {
	Result     string
	ResultInfo string
}

type DoubleGrader

type DoubleGrader struct{}

func (DoubleGrader) CompareStream

func (grader DoubleGrader) CompareStream(session *GradeSession, expectedAnswerFile *os.File, done chan CaseReturn)

type EndTrimGrader

type EndTrimGrader struct{}

func (EndTrimGrader) CompareStream

func (grader EndTrimGrader) CompareStream(session *GradeSession, expectedAnswerFile *os.File, done chan CaseReturn)

type FieldGrader

type FieldGrader struct{}

func (FieldGrader) CompareStream

func (grader FieldGrader) CompareStream(session *GradeSession, expectedAnswerFile *os.File, done chan CaseReturn)

type GradeSession

type GradeSession struct {
	JudgingSession *shared.JudgeSession

	// case information
	Problem     *pb.Problem
	Solution    *pb.Solution
	CurrentCase *cache.CachedTestDataCase
	BatchNum    uint64
	CaseNum     uint64

	// streams during judging
	OutputStream *os.File
	ErrorStream  *os.File
	InputStream  *os.File

	Stderr string // error dumped here

	StreamResult chan pb.TestCaseResult // return result to runner
	StreamDone   chan CaseReturn        // end batch case with verdict
	DoneSent     bool                   // whether or not the done channel was used

	// for forkexec
	Command  *exec.Cmd
	ExecFile uintptr

	// seccomp & ptrace
	SandboxWithSeccomp bool
	SeccompProfile     util.SandboxProfile

	// sandbox session
	RunnerSession sandbox.RunnerSession
	RunnerResult  sandbox.RunnerSessionResult
}

func (*GradeSession) CloseStreams

func (session *GradeSession) CloseStreams()

func (*GradeSession) InitIOFiles

func (session *GradeSession) InitIOFiles()

func (*GradeSession) StartJudging

func (session *GradeSession) StartJudging()

func (*GradeSession) WaitVerdict

func (session *GradeSession) WaitVerdict()

type Grader

type Grader interface {
	// must wait on session.StreamProcEnd and send output to done
	CompareStream(session *GradeSession, expectedAnswer *os.File, done chan CaseReturn)
}

type JudgeJob

type JudgeJob struct {
	Req       *pb.TestSolutionRequest
	Res       chan shared.JudgeStatus
	Cancelled *bool
}

type StrictGrader

type StrictGrader struct{}

func (StrictGrader) CompareStream

func (grader StrictGrader) CompareStream(session *GradeSession, expectedAnswerFile *os.File, done chan CaseReturn)

Jump to

Keyboard shortcuts

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