Documentation ¶
Overview ¶
package lib is a library that provides all the job management utilities for Runner
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RunnerHome = "/tmp/runner" RootFSSource string // path to the new root file system for jobs )
TODO: These are global exported variables for now. They should be part of some sort library configuration that can be initialized by the user.
View Source
var Debug = false
Debug enables verbose logging in the library
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job interface { // ID returns the job identifier ID() string // Stop stops a running job Stop() // Status returns the status and exit code of the job Status() (status JobStatus, exitCode int) // Output returns an out channel from which the output of a job can be consumed. The cancel // function can be used to stop streaming output from the job. Once cancel function is invoked, // the out channel is closed Output() (out <-chan *Output, cancel func(), err error) // Wait waits for the job to finish Wait() }
Job is the interface that wraps all the functions of a job
type JobConfig ¶
type JobConfig struct { Command string // Command including arguments to run as a job Timeout time.Duration // Timeout determines how long a job is allowed to run Profile ResProfile // Profile determines the resource profile that should be applied to a job }
JobConfig represents the configuration required to start a job
type JobStatus ¶
type JobStatus int
JobStatus represents the status of a job
const ( // StatusCreated denotes a newly created job that's not yet started StatusCreated JobStatus = iota - 1 // StatusRunning denotes a job that's in running state StatusRunning // StatusCompleted denotes a job that ran to its completion StatusCompleted // StatusStopped denotes a job that was stopped by the caller StatusStopped // StatusTimedOut denotes a job that was killed due to timeout expiration StatusTimedOut )
type Output ¶
type Output struct {
Bytes []byte
}
Output represents a few bytes of output generated by a job
type ResProfile ¶
type ResProfile string
ResProfile is the name of the resource profile that should be applied to the job
const (
ResProfileDefault ResProfile = "default"
)
Click to show internal directories.
Click to hide internal directories.