-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
make -J behavior default in test.py #40945
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
Changes from 4 commits
d2244c1
c85a45b
1fe77c7
01db947
54996df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1362,9 +1362,9 @@ def BuildOptions(): | |
| default="") | ||
| result.add_option("--warn-unused", help="Report unused rules", | ||
| default=False, action="store_true") | ||
| result.add_option("-j", help="The number of parallel tasks to run", | ||
| default=1, type="int") | ||
| result.add_option("-J", help="Run tasks in parallel on all cores", | ||
| result.add_option("-j", help="The number of parallel tasks to run, 0=use number of cores", | ||
| default=0, type="int") | ||
| result.add_option("-J", help="For legacy compatibility, has no effect", | ||
| default=False, action="store_true") | ||
| result.add_option("--time", help="Print timing information after running", | ||
| default=False, action="store_true") | ||
|
|
@@ -1423,11 +1423,16 @@ def ProcessOptions(options): | |
| if options.run[0] >= options.run[1]: | ||
| print("The test group to run (n) must be smaller than number of groups (m).") | ||
| return False | ||
| if options.J: | ||
| if options.j == 0: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes precedence of the It's probably a rare edge case that both flags would be specified.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we keep it so If we want to preserve that behavior, then perhaps the thing to do is print a warning when someone is using both I suspect, like you, that this is a rare edge case. I also suspect that it basically does not matter. Like, if we run with 2 processes instead of 4 (or the other way around) in a rare edge case....oh well? @richardlau Would you be comfortable if we kept the behavior as it is in this PR but add a warning that gets printed if both
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be okay with that.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is the behavior I've implemented in a fixup commit. PTAL. |
||
| # inherit JOBS from environment if provided. some virtualised systems | ||
| # tends to exaggerate the number of available cpus/cores. | ||
| cores = os.environ.get('JOBS') | ||
| options.j = int(cores) if cores is not None else multiprocessing.cpu_count() | ||
| elif options.J: | ||
| # If someone uses -j and legacy -J, let them know that we will be respecting | ||
| # -j and ignoring -J, which is the opposite of what we used to do before -J | ||
| # became a legacy no-op. | ||
| print('Warning: Legacy -J option is ignored. Using the -j option.') | ||
| if options.flaky_tests not in [RUN, SKIP, DONTCARE]: | ||
| print("Unknown flaky-tests mode %s" % options.flaky_tests) | ||
| return False | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.