Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/task/run/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"strings"

"github.com/datarobot/cli/internal/cli"
"github.com/datarobot/cli/internal/countflags"
"github.com/datarobot/cli/internal/log"
"github.com/datarobot/cli/internal/task"
"github.com/datarobot/cli/internal/telemetry"
Expand Down Expand Up @@ -183,7 +184,7 @@ Examples:

cmd.Flags().StringVarP(&opts.Dir, "dir", "d", ".", "📁 Specify project directory (default: current directory)")
cmd.Flags().BoolVarP(&opts.taskOpts.Parallel, "parallel", "p", false, "⚡ Run multiple tasks simultaneously for faster execution")
cmd.Flags().IntVarP(&opts.taskOpts.Concurrency, "concurrency", "C", 2, "🔢 Number of concurrent tasks to run in parallel")
cmd.Flags().VarP(countflags.PositiveInt(&opts.taskOpts.Concurrency, 2), "concurrency", "C", "🔢 Number of concurrent tasks to run in parallel")
cmd.Flags().BoolVarP(&opts.taskOpts.WatchTask, "watch", "w", false, "👀 Watch files and re-run task on changes")
cmd.Flags().BoolVarP(&opts.taskOpts.AnswerYes, "yes", "y", false, "🚀 Skip confirmation prompts (useful for automation)")
cmd.Flags().BoolVarP(&opts.taskOpts.ExitCode, "exit-code", "x", false, "🔄 Pass through the exact exit code from task")
Expand Down
11 changes: 11 additions & 0 deletions cmd/task/run/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,17 @@ func TestCmdReturnsErrNotInTemplateWhenDatarobotMissing(t *testing.T) {
require.ErrorIs(t, err, cli.ErrSilent)
}

func TestCmdRejectsNonPositiveConcurrency(t *testing.T) {
// Rejected at parse time by countflags.PositiveInt, before any task
// runner is looked up: zero concurrency would run nothing.
cmd := Cmd()
cmd.SetArgs([]string{"--concurrency", "0", "start"})

err := cmd.Execute()
require.Error(t, err)
require.Contains(t, err.Error(), "must be a positive integer")
}

// TestCmdStopsGeneratedTaskThatInvokesItself covers the recipe template's
// `lint: [dr task run lint]` against a project with no committed root Taskfile.
// Nothing sets DATAROBOT_CLI_TASK_RUN_FROM_ROOT on that path, so every
Expand Down
Loading