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

Allow % based configuration of max workers #7494

Merged
merged 6 commits into from
Dec 11, 2018

Conversation

phawxby
Copy link
Contributor

@phawxby phawxby commented Dec 10, 2018

Summary

We have various machines in use between 4-16 threads but we always need to have spare threads available for other things like puppeteer/chrome. Doing this will allow simple --maxWorkers=50% to always have spare CPU available;

Test plan

$ node ./packages/jest-cli/bin/jest.js getMaxWorkers.test.js
 PASS  packages/jest-config/src/__tests__/getMaxWorkers.test.js
  getMaxWorkers
    √ Returns 1 when runInBand (3ms)
    √ Returns 1 when the OS CPUs are not available (1ms)
    √ Returns the `maxWorkers` when specified
    √ Returns based on the number of cpus (1ms)
    % based
      √ 50% = 2 workers
      √ < 0 workers should become 1 (1ms)
      √ 0% shouldn't break

Test Suites: 1 passed, 1 total
Tests:       7 passed, 7 total
Snapshots:   0 total
Time:        1.315s, estimated 2s
Ran all test suites matching /getMaxWorkers.test.js/i.
Done in 2.96s.

@codecov-io
Copy link

codecov-io commented Dec 10, 2018

Codecov Report

Merging #7494 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7494      +/-   ##
==========================================
+ Coverage   67.44%   67.46%   +0.01%     
==========================================
  Files         247      247              
  Lines        9511     9516       +5     
  Branches        6        6              
==========================================
+ Hits         6415     6420       +5     
  Misses       3094     3094              
  Partials        2        2
Impacted Files Coverage Δ
packages/jest-config/src/getMaxWorkers.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 509272d...b0eb1d9. Read the comment docs.

@rickhanlonii
Copy link
Member

Thoughts @cpojer?

@cpojer
Copy link
Member

cpojer commented Dec 11, 2018

Sure.

Copy link
Member

@rickhanlonii rickhanlonii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple comments to review

CHANGELOG.md Outdated Show resolved Hide resolved
docs/CLI.md Outdated Show resolved Hide resolved
@rickhanlonii
Copy link
Member

LGTM, thanks!

@rickhanlonii rickhanlonii merged commit df78255 into jestjs:master Dec 11, 2018
thymikee added a commit to spion/jest that referenced this pull request Dec 18, 2018
* master: (24 commits)
  Add `jest.isolateModules` for scoped module initialization (jestjs#6701)
  Migrate to Babel 7 (jestjs#7016)
  docs: changed "Great Scott!" link (jestjs#7524)
  Use reduce instead of filter+map in dependency_resolver (jestjs#7522)
  Update Configuration.md (jestjs#7455)
  Support dashed args (jestjs#7497)
  Allow % based configuration of max workers (jestjs#7494)
  chore: Standardize filenames: jest-runner pkg (jestjs#7464)
  allow `bail` setting to control when to bail out of a failing test run (jestjs#7335)
  Add issue template labels (jestjs#7470)
  chore: standardize filenames in e2e/babel-plugin-jest-hoist (jestjs#7467)
  Add node worker-thread support to jest-worker (jestjs#7408)
  Add `testPathIgnorePatterns` to CLI documentation (jestjs#7440)
  pretty-format: Omit non-enumerable symbol properties (jestjs#7448)
  Add Jest Architecture overview to docs. (jestjs#7449)
  chore: run appveyor tests on node 10
  chore: fix failures e2e test for node 8 (jestjs#7446)
  chore: update docusaurus to v1.6.0 (jestjs#7445)
  Enhancement/expect-to-be-close-to-with-infinity (jestjs#7444)
  Update CHANGELOG formatting (jestjs#7429)
  ...
willsmythe pushed a commit to willsmythe/jest that referenced this pull request Dec 20, 2018
* Allow % based configuration of max workers

* Add pull ref

* Whoops, copy and paste

* Update docs/CLI.md

Co-Authored-By: phawxby <phawxby@gmail.com>

* Move changlog entry
captain-yossarian pushed a commit to captain-yossarian/jest that referenced this pull request Jul 18, 2019
* Allow % based configuration of max workers

* Add pull ref

* Whoops, copy and paste

* Update docs/CLI.md

Co-Authored-By: phawxby <phawxby@gmail.com>

* Move changlog entry
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants