armadactl

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package armadactl contains all the business logic for armadactl. It has no dependency on either viper or cobra libraries, and can be unit tested.

Output writer for the App is configurable so that tests can easily capture and perform assertions on it. Params are initialised in the param package, so that this package can be clear of viper dependency.

TODO there should be a type that uniquely represents a job, instead of having to pass around several parameters

TODO add methods for querying more detailed info about queues and jobs (current priority and so on)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// Parameters passed to the CLI by the user.
	Params *Params
	// Out is used to write the output. Default to standard out,
	// but can be overridden in tests to make assertions on the applications's output.
	Out io.Writer
	// Source of randomness. Tests can use a mocked random source in order to provide
	// deterministic testing behaviour.
	Random io.Reader
}

func New

func New() *App

New instantiates an App with default parameters, including standard output and cryptographically secure random source.

func (*App) CancelJob added in v0.5.0

func (a *App) CancelJob(queue string, jobSetId string, jobId string) (outerErr error)

func (*App) CancelJobSet added in v0.5.0

func (a *App) CancelJobSet(queue string, jobSetId string) (outerErr error)

func (*App) CordonExecutor added in v0.15.0

func (a *App) CordonExecutor(executor string, cordonReason string) error

func (*App) CordonQueues added in v0.9.8

func (a *App) CordonQueues(queryArgs *QueueQueryArgs, dryRun bool) error

func (*App) CreateQueue

func (a *App) CreateQueue(queue queue.Queue) error

CreateQueue calls app.QueueAPI.Create with the provided parameters.

func (*App) CreateResource

func (a *App) CreateResource(fileName string, dryRun bool) error

func (*App) DeleteQueue

func (a *App) DeleteQueue(name string) error

DeleteQueue calls app.QueueAPI.Delete with the provided parameters.

func (*App) GetAllQueues added in v0.9.8

func (a *App) GetAllQueues(args *QueueQueryArgs) error

GetAllQueues calls app.QueueAPI.GetAll with the provided parameters. This method fetches all queues, and filters for those where the queue name is in the provided queueNames and the queue contains all specified labels. If either the labels or queueNames slices are empty, any checks on them are ignored. The inverse flag inverts the result, returning all queues not matching the specified criteria.

func (*App) GetJobSchedulingReport

func (a *App) GetJobSchedulingReport(jobId string) error

func (*App) GetQueue added in v0.3.100

func (a *App) GetQueue(name string) error

GetQueue calls app.QueueAPI.Get with the provided parameters.

func (*App) GetQueueSchedulingReport

func (a *App) GetQueueSchedulingReport(queueName string, verbosity int32) error

func (*App) GetSchedulingReport added in v0.3.62

func (a *App) GetSchedulingReport(verbosity int32) error

func (*App) GetSchedulingReportForJob added in v0.3.71

func (a *App) GetSchedulingReportForJob(jobId string, verbosity int32) error

func (*App) GetSchedulingReportForQueue added in v0.3.71

func (a *App) GetSchedulingReportForQueue(queueName string, verbosity int32) error

func (*App) Preempt added in v0.4.41

func (a *App) Preempt(queue string, jobSetId string, jobId string) (outerErr error)

Preempt a job.

func (*App) ReprioritizeJob added in v0.5.0

func (a *App) ReprioritizeJob(queue string, jobSet string, jobId string, priorityFactor float64) error

Reprioritize sets the priority of the job identified by (jobId) to priorityFactor

func (*App) ReprioritizeJobSet added in v0.5.0

func (a *App) ReprioritizeJobSet(queueName string, jobSet string, priorityFactor float64) error

ReprioritizeJobSet sets the priority of the jobSet identified by (queueName, jobSet) to priorityFactor

func (*App) Submit

func (a *App) Submit(path string, dryRun bool) error

Submit a job, represented by a file, to the Armada server. If dry-run is true, the job file is validated but not submitted.

func (*App) UncordonExecutor added in v0.15.0

func (a *App) UncordonExecutor(executor string) error

func (*App) UncordonQueues added in v0.9.8

func (a *App) UncordonQueues(queryArgs *QueueQueryArgs, dryRun bool) error

func (*App) UpdateQueue

func (a *App) UpdateQueue(queue queue.Queue) error

UpdateQueue calls app.QueueAPI.Update with the provided parameters.

func (*App) Version

func (a *App) Version() error

Version prints build information (e.g., current git commit) to the app output.

func (*App) Watch

func (a *App) Watch(queue string, jobSetId string, raw bool, exitOnInactive bool, forceNewEvents bool, forceLegacyEvents bool) error

Watch prints events associated with a particular job set.

type ExecutorAPI added in v0.15.0

type ExecutorAPI struct {
	Cordon   executor.CordonAPI
	Uncordon executor.UncordonAPI
}

type Params

type Params struct {
	ApiConnectionDetails *client.ApiConnectionDetails
	QueueAPI             *QueueAPI
	ExecutorAPI          *ExecutorAPI
}

Params struct holds all user-customizable parameters. Using a single struct for all CLI commands ensures that all flags are distinct and that they can be provided either dynamically on a command line, or statically in a config file that's reused between command runs.

type QueueAPI

type QueueAPI struct {
	Create   queue.CreateAPI
	Delete   queue.DeleteAPI
	Get      queue.GetAPI
	GetAll   queue.GetAllAPI
	Update   queue.UpdateAPI
	Cordon   queue.CordonAPI
	Uncordon queue.UncordonAPI
}

QueueAPI struct holds pointers to functions that are called by armadactl. The function types are defined in in /pkg/client/queue. By default, they point to functions defined in /pkg/client/queue, which call the Armada server gRPC API. However, they are user-replaceable to facilitate testing. TODO Consider replacing with an interface

type QueueQueryArgs added in v0.9.8

type QueueQueryArgs struct {
	// Filter for queues where the InQueueNames slice contains the queue name
	InQueueNames []string
	// Filter for queues where the queue contains all labels specified in the ContainsAllLabels slice
	ContainsAllLabels []string
	// Filter for cordoned queues only
	OnlyCordoned bool
	// Applies the above filters and inverts the result
	InvertResult bool
}

QueueQueryArgs is used for retrieving queues or for cordoning/uncordoning

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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