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

Add maximum of workers to config #3516

Merged

Conversation

maxispeicher
Copy link
Contributor

@maxispeicher maxispeicher commented Dec 27, 2020

Resolves: #3465

Added a new installer.max-workers property to the configuration. If installer.parallel is set to true, the executor tries to get the new configuration property and will limit the number of processes to the number set in the configuration. If the value is not set, the same default value as before will be used.

  • Added tests for changed code.
  • Updated documentation for changed code.

poetry/installation/executor.py Outdated Show resolved Hide resolved
…processes

# Conflicts:
#	docs/configuration.md
#	poetry/console/commands/config.py
#	poetry/installation/executor.py
Copy link
Member

@neersighted neersighted left a comment

Choose a reason for hiding this comment

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

Another round of feedback -- I still think the logic is really jumbled, but can be simplified by calling self._get_max_workers() in only one place.

I also think we need slightly better tests and docs -- first off, if we're going to cap the number of max workers with min(), we should document that.

Secondly, let's be sure to test that behavior using mocking of both a working (but different from the testing machine) os.cpu_count() and a version that always throws NotImplementedError.

poetry/installation/executor.py Outdated Show resolved Hide resolved
poetry/utils/helpers.py Outdated Show resolved Hide resolved
poetry/installation/executor.py Outdated Show resolved Hide resolved
poetry/console/commands/config.py Outdated Show resolved Hide resolved
Copy link
Member

@neersighted neersighted left a comment

Choose a reason for hiding this comment

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

Overall looks good, and the executor tests are well-done. I just have some general feedback on the changes to the config tests.

tests/config/test_config.py Outdated Show resolved Hide resolved
tests/config/test_config.py Outdated Show resolved Hide resolved
tests/config/test_config.py Outdated Show resolved Hide resolved

flattened_config = flatten(config.default_config)
def get_options_based_on_normalizer(normalizer: Callable) -> str:
config = Config()
Copy link
Member

Choose a reason for hiding this comment

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

This line does nothing -- let's skip it...

flattened_config = flatten(config.default_config)
def get_options_based_on_normalizer(normalizer: Callable) -> str:
config = Config()
flattened_config = FlatDict(config.default_config, delimiter=".")
Copy link
Member

Choose a reason for hiding this comment

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

...in favor of this.

Suggested change
flattened_config = FlatDict(config.default_config, delimiter=".")
flattened_config = FlatDict(Config.default_config, delimiter=".")

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.

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

Successfully merging this pull request may close these issues.

Request control of number of parallel processes
2 participants