diff --git a/task/backend/scheduler.go b/task/backend/scheduler.go index 6870bd7b3d1..361d80db92f 100644 --- a/task/backend/scheduler.go +++ b/task/backend/scheduler.go @@ -6,6 +6,8 @@ import ( "errors" "fmt" "math" + "os" + "strconv" "sync" "sync/atomic" "time" @@ -469,6 +471,17 @@ func newTaskScheduler( return nil, err } maxC := defaultConcurrency + + // if an environment variable for default concurrency is set, use this value + // this will be overwritten if the Flux script for the task has a concurrency set + if envConcurrency := os.Getenv("DEFAULT_CONCURRENCY"); envConcurrency != "" { + c, err := strconv.Atoi(envConcurrency) + if err == nil { + maxC = c + + } + } + if opt.Concurrency != nil { maxC = int(*opt.Concurrency) }