Documentation ¶
Overview ¶
Package scheduler defines the interface in which a scheduler must adhere to. A scheduler is the mechanism in which gofer uses to schedule taskruns/containers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAmbiguousContainerName = errors.New("scheduler: more than one container was found for the given container name")
ErrAmbiguousContainerName is returned when we the scheduler attempts to operate on a single container but the given name results in multiple container matches.
View Source
var ErrNoSuchContainer = errors.New("scheduler: entity not found")
ErrNoSuchContainer is returned when a container requested could not be located on the scheduler.
View Source
var ErrNoSuchImage = errors.New("scheduler: docker image not found")
ErrNoSuchImage is returned when the requested container image could not be pulled.
Functions ¶
This section is empty.
Types ¶
type AttachContainerRequest ¶ added in v0.6.0
type AttachContainerResponse ¶ added in v0.6.0
type ContainerState ¶ added in v0.3.0
type ContainerState string
const ( ContainerStateUnknown ContainerState = "UNKNOWN" // The state of the run is unknown. // Before the tasks in a run is sent to a scheduler it must complete various steps like // validation checking. This state represents that step where the run and task_runs are // pre-checked. ContainerStateRunning ContainerState = "RUNNING" // Currently running. ContainerStatePaused ContainerState = "PAUSED" // Container is paused. ContainerStateRestarting ContainerState = "RESTARTING" ContainerStateExited ContainerState = "EXITED" // All tasks have been resolved and the run is no longer being executed. ContainerStateCancelled ContainerState = "CANCELLED" // Task was cancelled by request. )
type Engine ¶
type Engine interface { // StartContainer launches a new container on scheduler. StartContainer(request StartContainerRequest) (response StartContainerResponse, err error) // StopContainer attempts to stop a specific container identified by a unique container name. The scheduler // should attempt to gracefully stop the container, unless the timeout is reached. StopContainer(request StopContainerRequest) error // GetState returns the current state of the container translated to the "models.ContainerState" enum. GetState(request GetStateRequest) (response GetStateResponse, err error) // GetLogs reads logs from the container and passes it back to the caller via an io.Reader. This io.reader can // be written to from a goroutine so that they user gets logs as they are streamed from the container. // Finally once finished the io.reader should be close with an EOF denoting that there are no more logs to be read. GetLogs(request GetLogsRequest) (logs io.Reader, err error) // Attach to a running container for debugging or other purposes. Returns a net connection, should be closed when finished. AttachContainer(request AttachContainerRequest) (response AttachContainerResponse, err error) }
type EngineType ¶
type EngineType string
const ( // EngineDocker uses local docker instance to schedule tasks. EngineDocker EngineType = "docker" )
type GetLogsRequest ¶
type GetLogsRequest struct {
ID string
}
type GetStateRequest ¶
type GetStateRequest struct {
ID string // unique identification for container.
}
type GetStateResponse ¶
type GetStateResponse struct { ExitCode int64 State ContainerState }
type Networking ¶ added in v0.5.0
type Networking struct { // The bind port of the internal application within the container. // This allows us to specify which ports extensions come up on // and enables downstream schedulers to properly account for that and port map correctly. Port int }
type StartContainerRequest ¶
type StartContainerRequest struct { ID string // Unique identifier for the container. ImageName string // The docker image repository endpoint of the container; tag can be included. EnvVars map[string]string // Environment variables to be passed to the container RegistryAuth *models.RegistryAuth // User/Pass for auth registry // Even if the container exists attempt to pull from repository. This is useful if your containers // don't use proper tagging or versioning. AlwaysPull bool // Networking is used to communicate to the container via RPC. This is only needed by extensions. Networking *Networking Entrypoint *[]string Command *[]string }
type StartContainerResponse ¶
type StartContainerResponse struct {
URL string // optional endpoint if "EnableNetworking" was used.
}
type StopContainerRequest ¶
Click to show internal directories.
Click to hide internal directories.