Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #400.
Implements the
-n cpuform that was agreed in the issue thread:--process/-nnow acceptscpuin addition to an integer, and resolves it toos.cpu_count(). The default stays0(no parallel execution), so nothing changes for existing invocations.Changes:
doit/cmd_run.py:num_process_typeconverter ('cpu'→os.cpu_count() or 1, otherwiseint); optiontypeand help text updated.doit/cmdparse.py: the "Error parsing parameter" message now prints the type's__name__instead of its repr, so a callable type renders as(num_process_type)rather than<function ... at 0x...>.tests/test_cmd_run.py:test_num_processcovering default, integer,cpu, and an invalid value.CHANGES,doc/cmd-run.rst.Validation (Python 3.11,
rut 0.4.0):rut tests/test_cmd_run.pybefore the change:test_num_processfails withinvalid literal for int() with base 10: 'cpu'; after: 15 passed.rut: 830 passed, 1 failed —tests/test___main__.py::TestMain.test_execute, which fails identically on a clean checkout ofda5a25fhere (it imports the repo'sdodo.py, whose imports are not installed in my env), so unrelated to this change.doit -n cpuanddoit -n 2 -P threadon a two-taskdodo.pyrun both tasks;doit -n xyzexits 3 withError parsing parameter 'num_process' (num_process_type). expected an integer or 'cpu', got 'xyz'.