workers

package
v0.0.0-...-e361b34 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2019 License: MIT Imports: 24 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrExecResultParse = errors.New("exec result parse error")
View Source
var (
	ErrTimeTextParse = errors.New("time.txtの内容がパースできません。")
)

Functions

This section is empty.

Types

type ExecResult

type ExecResult struct {
	Status      ExecStatus    `json:"status"`
	ExecTime    time.Duration `json:"execTime"`
	MemoryUsage int64         `json:"memoryUsage"`
	Stdout      string        `json:"stdout"`
	Stderr      string        `json:"stderr"`
	ExitStatus  int           `json:"exitStatus"`
}

type ExecResultParser

type ExecResultParser struct {
	// contains filtered or unexported fields
}

func NewExecResultParser

func NewExecResultParser(w *Worker) (ExecResultParser, error)

func (*ExecResultParser) Next

func (p *ExecResultParser) Next() (bool, *ExecResult, error)

type ExecStatus

type ExecStatus int
const (
	StatusFinished            ExecStatus = 0
	StatusTimeLimitExceeded   ExecStatus = 1
	StatusMemoryLimitExceeded ExecStatus = 2
	StatusRuntimeError        ExecStatus = 3
	StatusUnknownError        ExecStatus = 4
	StatusOutputLimitExceeded ExecStatus = 5

	Workspace    = "/tmp/koj-workspace/"
	JudgeDataDir = Workspace + "judge_data"
)

type OutputParser

type OutputParser struct {
	// contains filtered or unexported fields
}

func (*OutputParser) Next

func (p *OutputParser) Next() (bool, string, error)

type Worker

type Worker struct {
	ID string

	TimeLimit        time.Duration
	MemoryLimit      int64
	HostJudgeDataDir string
	// contains filtered or unexported fields
}

func NewJudgementWorker

func NewJudgementWorker(img string, timeLimit time.Duration, memoryLimit int64, cmd []string) (*Worker, error)

func NewTimeoutWorker

func NewTimeoutWorker(img string, timeLimit time.Duration, memoryLimit int64, cmd []string) (*Worker, error)

func (*Worker) CopyContentToContainer

func (w *Worker) CopyContentToContainer(content []byte, name string) error

func (*Worker) CopyFileToContainer

func (w *Worker) CopyFileToContainer(src, dst string) error

func (*Worker) CopyTo

func (w *Worker) CopyTo(filename string, dist *Worker) error

func (*Worker) Remove

func (w *Worker) Remove() error

func (*Worker) Run

func (w *Worker) Run(input string, parseOutput bool) (*ExecResult, error)

Jump to

Keyboard shortcuts

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