Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tasks): use env variable for concurrency #15110

Merged
merged 1 commit into from
Sep 10, 2019
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## v2.0.0-alpha.18 [unreleased]

### Features
1. [15110](https://github.com/influxdata/influxdb/pull/15110): Adds ability to set the default concurrency for tasks with an environment variable called DEFAULT_CONCURRENCY

### UI Improvements

Expand Down
12 changes: 12 additions & 0 deletions task/backend/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"errors"
"fmt"
"math"
"os"
"strconv"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -469,6 +471,16 @@ 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)
}
Expand Down