Skip to content

Commit 32e80bb

Browse files
authored
DATA-3102 - Make the status optional for listing training jobs (viamrobotics#4346)
1 parent 8228826 commit 32e80bb

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cli/app.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ var app = &cli.App{
10641064
{
10651065
Name: "list",
10661066
Usage: "list training jobs in Viam cloud based on organization ID",
1067-
UsageText: createUsageText("train list", []string{generalFlagOrgID, trainFlagJobStatus}, false),
1067+
UsageText: createUsageText("train list", []string{generalFlagOrgID}, true),
10681068
Flags: []cli.Flag{
10691069
&cli.StringFlag{
10701070
Name: generalFlagOrgID,
@@ -1074,7 +1074,8 @@ var app = &cli.App{
10741074
&cli.StringFlag{
10751075
Name: trainFlagJobStatus,
10761076
Usage: "training status to filter for. can be one of " + allTrainingStatusValues(),
1077-
Required: true,
1077+
Required: false,
1078+
Value: defaultTrainingStatus(),
10781079
},
10791080
},
10801081
Action: DataListTrainingJobs,

cli/ml_training.go

+4
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ func allTrainingStatusValues() string {
305305
return "[" + strings.Join(formattedStatuses, ", ") + "]"
306306
}
307307

308+
func defaultTrainingStatus() string {
309+
return strings.ToLower(strings.TrimPrefix(mltrainingpb.TrainingStatus_TRAINING_STATUS_UNSPECIFIED.String(), trainingStatusPrefix))
310+
}
311+
308312
// MLTrainingUploadAction uploads a new custom training script.
309313
func MLTrainingUploadAction(c *cli.Context) error {
310314
client, err := newViamClient(c)

0 commit comments

Comments
 (0)