Skip to content

Commit

Permalink
Allow to override the number of processor with an env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
bpaquet committed Sep 25, 2019
1 parent da9cd60 commit e2e17d2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
====
Expand Down
2 changes: 1 addition & 1 deletion lib/parallel/processor_count.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e2e17d2

Please sign in to comment.