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 ¶
- type App
- func (a *App) Analyze(queue string, jobSetId string) error
- func (a *App) Cancel(queue string, jobSetId string, jobId string) (outerErr error)
- func (a *App) CreateQueue(queue queue.Queue) error
- func (a *App) CreateResource(fileName string, dryRun bool) error
- func (a *App) DeleteQueue(name string) error
- func (a *App) DescribeQueue(name string) error
- func (a *App) GetJobSchedulingReport(jobId string) error
- func (a *App) GetQueueSchedulingReport(queue string) error
- func (a *App) Kube(jobId string, queueName string, jobSetId string, podNumber int, args []string) error
- func (a *App) Reprioritize(jobId string, queueName string, jobSet string, priorityFactor float64) error
- func (a *App) Resources(queueName string, jobSetId string) error
- func (a *App) Submit(path string, dryRun bool) error
- func (a *App) UpdateQueue(queue queue.Queue) error
- func (a *App) Version() error
- func (a *App) Watch(queue string, jobSetId string, raw bool, exitOnInactive bool, ...) error
- type Params
- type QueueAPI
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) Cancel ¶
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 ¶
CreateQueue calls app.QueueAPI.Create with the provided parameters.
func (*App) DeleteQueue ¶
DeleteQueue calls app.QueueAPI.Delete with the provided parameters.
func (*App) DescribeQueue ¶
DescribeQueue calls app.QueueAPI.Describe with the provided parameters.
func (*App) GetJobSchedulingReport ¶
func (*App) GetQueueSchedulingReport ¶
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 ¶
Resources prints the resources used by the jobs in job set with ID jobSetId in the given queue.
func (*App) Submit ¶
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 ¶
UpdateQueue calls app.QueueAPI.Update with the provided parameters.
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