diff --git a/Readme.md b/Readme.md index ebbe86f9..05ae44fe 100644 --- a/Readme.md +++ b/Readme.md @@ -156,6 +156,7 @@ Here are a few notable options. - [Benchmark/Test] Disable threading/forking with `in_threads: 0` or `in_processes: 0`, great to test performance or to debug parallel issues - [Isolation] Do not reuse previous worker processes: `isolation: true` - [Stop all processses with an alternate interrupt signal] `'INT'` (from `ctrl+c`) is caught by default. Catch `'TERM'` (from `kill`) with `interrupt_signal: 'TERM'` + - You can set the environment variable `PARALLEL_OVERRIDE_PROCESSOR_COUNT` to use a custom default value of procesess / threads instead of the number of processors detected. TODO ==== diff --git a/lib/parallel/processor_count.rb b/lib/parallel/processor_count.rb index 9ba65249..a929ab5d 100644 --- a/lib/parallel/processor_count.rb +++ b/lib/parallel/processor_count.rb @@ -5,7 +5,7 @@ module ProcessorCount # Number of processors seen by the OS and used for process scheduling. It's just wrapper for Etc.nprocessors def processor_count @processor_count ||= begin - Etc.nprocessors + (ENV['PARALLEL_OVERRIDE_PROCESSOR_COUNT'] || Etc.nprocessors).to_i end end