Skip to content

Commit 873a321

Browse files
committed
Remove some unnecessary futzing with GOMAXPROCS.
1 parent 44d8725 commit 873a321

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

cmd/src/batch_common.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func newBatchExecuteFlags(flagSet *flag.FlagSet, workspaceExecution bool, cacheD
123123

124124
flagSet.IntVar(
125125
&caf.parallelism, "j", 0,
126-
"The maximum number of parallel jobs. Default (or 0) is the number of CPU cores available to Docker, or GOMAXPROCS if Docker cannot report its number of cores.",
126+
"The maximum number of parallel jobs. Default (or 0) is the number of CPU cores available to Docker.",
127127
)
128128
flagSet.DurationVar(
129129
&caf.timeout, "timeout", 60*time.Minute,
@@ -544,19 +544,5 @@ func getBatchParallelism(ctx context.Context, flag int) (int, error) {
544544
return flag, nil
545545
}
546546

547-
ncpu, err := docker.NCPU(ctx)
548-
var terr docker.TimeoutError
549-
if errors.As(err, &terr) {
550-
return 0, err
551-
} else if err != nil {
552-
// In the case of errors from Docker itself, we want to fall back to
553-
// GOMAXPROCS, since it's possible Docker just doesn't have access to
554-
// the CPU core count (either due to permissions, or being too old).
555-
//
556-
// It would obviously be better if we had a global logger available to
557-
// log this.
558-
return runtime.GOMAXPROCS(0), nil
559-
}
560-
561-
return ncpu, nil
547+
return docker.NCPU(ctx)
562548
}

internal/batches/docker/context.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ type fastCommandTimeoutError struct {
3737
timeout time.Duration
3838
}
3939

40-
type TimeoutError interface {
41-
Timeout() bool
42-
}
43-
44-
var _ TimeoutError = &fastCommandTimeoutError{}
45-
4640
func newFastCommandTimeoutError(ctx context.Context, args ...string) error {
4741
// Attempt to extract the timeout from the context.
4842
timeout, ok := ctx.Value(fastCommandTimeoutEnv).(time.Duration)

0 commit comments

Comments
 (0)