From 32e80bb545332ec7f6635b5eed4af93491e1fe0e Mon Sep 17 00:00:00 2001 From: Tahiya Date: Wed, 4 Sep 2024 15:38:07 -0400 Subject: [PATCH] DATA-3102 - Make the status optional for listing training jobs (#4346) --- cli/app.go | 5 +++-- cli/ml_training.go | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cli/app.go b/cli/app.go index 9e14116ce7a..737ff3f93da 100644 --- a/cli/app.go +++ b/cli/app.go @@ -1064,7 +1064,7 @@ var app = &cli.App{ { Name: "list", Usage: "list training jobs in Viam cloud based on organization ID", - UsageText: createUsageText("train list", []string{generalFlagOrgID, trainFlagJobStatus}, false), + UsageText: createUsageText("train list", []string{generalFlagOrgID}, true), Flags: []cli.Flag{ &cli.StringFlag{ Name: generalFlagOrgID, @@ -1074,7 +1074,8 @@ var app = &cli.App{ &cli.StringFlag{ Name: trainFlagJobStatus, Usage: "training status to filter for. can be one of " + allTrainingStatusValues(), - Required: true, + Required: false, + Value: defaultTrainingStatus(), }, }, Action: DataListTrainingJobs, diff --git a/cli/ml_training.go b/cli/ml_training.go index fe3db077c2d..d3d4a1913d3 100644 --- a/cli/ml_training.go +++ b/cli/ml_training.go @@ -305,6 +305,10 @@ func allTrainingStatusValues() string { return "[" + strings.Join(formattedStatuses, ", ") + "]" } +func defaultTrainingStatus() string { + return strings.ToLower(strings.TrimPrefix(mltrainingpb.TrainingStatus_TRAINING_STATUS_UNSPECIFIED.String(), trainingStatusPrefix)) +} + // MLTrainingUploadAction uploads a new custom training script. func MLTrainingUploadAction(c *cli.Context) error { client, err := newViamClient(c)