armadactl

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 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) 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) 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) 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(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) 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
	Get    queue.GetAPI
	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