task

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

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

A Handle is used by the driver plugin to keep track of active tasks.

Handle must be comletetly thread-safe; all operations must go through the lock.

func NewHandle

func NewHandle(runner shim.ExecTwo, config *drivers.TaskConfig) (*Handle, time.Time)

func RecreateHandle

func RecreateHandle(runner shim.ExecTwo, config *drivers.TaskConfig, started time.Time) *Handle

func (*Handle) Block

func (h *Handle) Block()

func (*Handle) IsRunning

func (h *Handle) IsRunning() bool

func (*Handle) Signal

func (h *Handle) Signal(s string) error

func (*Handle) Stats

func (h *Handle) Stats() *resources.Utilization

func (*Handle) Status

func (h *Handle) Status() *drivers.TaskStatus

func (*Handle) Stop

func (h *Handle) Stop(signal string, timeout time.Duration) error

type ID

type ID = string

ID is a task ID

type State

type State struct {
	TaskConfig *drivers.TaskConfig
	StartedAt  time.Time
	PID        int
	Cancel     func()
}

State is the runtime state encoded in the handle, returned to the Nomad client. Used to rebuild the task state and handler during recover.

type Store

type Store interface {
	Set(ID, *Handle)
	Get(ID) (*Handle, bool)
	Del(ID)
}

A Store is used to keep track of task handles in memory.

func NewStore

func NewStore() Store

Jump to

Keyboard shortcuts

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