jobmanager

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJobFromDescriptor

func NewJobFromDescriptor(ctx xcontext.Context, registry *pluginregistry.PluginRegistry, jobDescriptor *job.Descriptor) (*job.Job, error)

NewJobFromDescriptor creates a job object from a job descriptor

func NewJobFromExtendedDescriptor

func NewJobFromExtendedDescriptor(ctx xcontext.Context, registry *pluginregistry.PluginRegistry, jobDescriptor *job.ExtendedDescriptor) (*job.Job, error)

NewJobFromExtendedDescriptor creates a job object from an extended job descriptor

func NewJobFromJSONDescriptor

func NewJobFromJSONDescriptor(ctx xcontext.Context, registry *pluginregistry.PluginRegistry, jobDescriptorJSON string) (*job.Job, error)

NewJobFromJSONDescriptor builds a descriptor object from a JSON serialization

Types

type ErrorEventPayload

type ErrorEventPayload struct {
	Err xjson.Error
}

ErrorEventPayload represents the payload carried by a failure event (e.g. JobStateFailed, JobStateCancelled, etc.)

type JobManager

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

JobManager is the core component for the long-running job management service. It handles API requests, test fetching, target fetching, and jobs lifecycle.

In more detail, it is responsible for: * spawning the API listener, and handling the incoming requests * fetching targets, via target managers * fetching test definitions, via test fetchers * enqueuing new job requests, and handling their status * starting, stopping, and retrying jobs

func New

func New(l api.Listener, pr *pluginregistry.PluginRegistry, storageEngineVault storage.EngineVault, opts ...Option) (*JobManager, error)

New initializes and returns a new JobManager with the given API listener.

func (*JobManager) CancelAll

func (jm *JobManager) CancelAll(ctx xcontext.Context)

CancelAll cancels all running jobs.

func (*JobManager) CancelJob

func (jm *JobManager) CancelJob(jobID types.JobID) error

CancelJob sends a cancellation request to a specific job.

func (*JobManager) PauseAll

func (jm *JobManager) PauseAll(ctx xcontext.Context)

CancelAll pauses all running jobs.

func (*JobManager) Run

func (jm *JobManager) Run(ctx xcontext.Context, resumeJobs bool) error

Run is responsible for starting the API listener and responding to incoming events.

func (*JobManager) StopAPI

func (jm *JobManager) StopAPI()

StopAPI stops accepting new requests.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is an additional argument to method New to change the behavior of the JobManager.

func APIOption

func APIOption(option api.Option) Option

APIOption is a syntax-sugar function which just wraps an api.Option into OptionAPI.

func OptionClock

func OptionClock(clk clock.Clock) Option

OptionClock wraps clock.Clock to be used as an option.

type OptionAPI

type OptionAPI struct {
	api.Option
}

OptionAPI wraps api.Option to implement Option.

type OptionInstanceTag

type OptionInstanceTag string

OptionInstanceTag wraps a string to be used as instance tag.

type OptionTargetLockDuration

type OptionTargetLockDuration time.Duration

OptionTargetLockDuration wraps time.Duration to be used as an option.

Jump to

Keyboard shortcuts

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