armadactl

package
v0.3.61 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: Apache-2.0 Imports: 21 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) Analyze

func (a *App) Analyze(queue string, jobSetId string) error

func (*App) Cancel

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

Cancel cancels a job. TODO this method does too much; there should be separate methods to cancel individual jobs and all jobs in a job set

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) DescribeQueue

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

DescribeQueue calls app.QueueAPI.Describe with the provided parameters.

func (*App) GetJobSchedulingReport

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

func (*App) GetQueueSchedulingReport

func (a *App) GetQueueSchedulingReport(queue string) error

func (*App) Kube

func (a *App) Kube(jobId string, queueName string, jobSetId string, podNumber int, args []string) error

Kube prints kubectl commands for querying the pods associated with a particular job identified by the given jobId, queueName, jobSetId, and podNumber.

func (*App) Reprioritize

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

Reprioritize sets the priority of the job identified by (jobId, queueName, jobSet) to priorityFactor TODO We should have separate methods to operate on individual jobs and job sets

func (*App) Resources

func (a *App) Resources(queueName string, jobSetId string) error

Resources prints the resources used by the jobs in job set with ID jobSetId in the given queue.

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) 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 Params

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

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
	GetInfo queue.GetInfoAPI
	Update  queue.UpdateAPI
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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