backend

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Task  pythia.Task
	Input string

	// Path to the UML executable
	UmlPath string

	// Path to the directory containing the environments
	EnvDir string

	// Path to the directory containing the tasks
	TasksDir string
	// contains filtered or unexported fields
}

A Job is the combination of a task and an input. Jobs are executed inside a sandbox.

New jobs shall be created with the NewJob function.

The Job type implements the pythia.Component interface so that a job can be launched from the CLI for debugging purposes.

func NewJob

func NewJob() *Job

NewJob returns a new job, filled with default parameters. To execute the job, Task and Input have to be filled, and Execute() called.

func (*Job) Abort

func (job *Job) Abort()

Abort aborts the execution of the job.

func (*Job) Execute

func (job *Job) Execute() (status pythia.Status, output string)

Execute the job in a sandbox, wait for it to complete (or time out), and return the result.

func (*Job) Run

func (job *Job) Run()

Execute the job when launched from the CLI. The result is shown on stdout.

func (*Job) Setup

func (job *Job) Setup(fs *flag.FlagSet, args []string) error

Setup the parameters with the command line flags in args.

func (*Job) Shutdown

func (job *Job) Shutdown()

Abort the job if it is still running.

type Pool

type Pool struct {
	// Maximum number of sandboxes that may run at the same time
	Capacity int

	// Path to the UML executable
	UmlPath string

	// Path to the directory containing the environments
	EnvDir string

	// Path to the directory containing the tasks
	TasksDir string
	// contains filtered or unexported fields
}

A Pool is a component that launches sandboxes on the local machine. Each Pool has a limit on the number of sandboxes that can run concurrently.

New pools shall be created by the NewPool function.

A Pool connects to the Queue, advertises its limits, and waits for jobs to execute.

func NewPool

func NewPool() *Pool

NewPool returns a new pool with default parameters.

func (*Pool) Run

func (pool *Pool) Run()

Run the Pool component.

func (*Pool) Setup

func (pool *Pool) Setup(fs *flag.FlagSet, args []string) error

Setup the parameters with the command line flags in args.

func (*Pool) Shutdown

func (pool *Pool) Shutdown()

Shut down the Pool component.

type Queue

type Queue struct {
	// The maximum number of jobs that can wait to be executed.
	Capacity int
	// contains filtered or unexported fields
}

The Queue is the central component of Pythia. It receives jobs (tasks with inputs) from front-ends and dispatches them to the sandboxes.

The Queue is the only component listening for connections. All other components connect to it.

func NewQueue

func NewQueue() *Queue

NewQueue returns a new queue with default parameters.

func (*Queue) Run

func (queue *Queue) Run()

Run runs the Queue component.

func (*Queue) Setup

func (queue *Queue) Setup(fs *flag.FlagSet, args []string) error

Setup configures the queue with the command line flags in args.

func (*Queue) Shutdown

func (queue *Queue) Shutdown()

Shutdown terminates the Queue component.

Jump to

Keyboard shortcuts

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