Skip to content

Commit

Permalink
DATA-3102 - Make the status optional for listing training jobs (#4346)
Browse files Browse the repository at this point in the history
  • Loading branch information
tahiyasalam authored Sep 4, 2024
1 parent 8228826 commit 32e80bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cli/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions cli/ml_training.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 32e80bb

Please sign in to comment.