Skip to content

Comments

Add maximum of workers to config#3516

Merged
neersighted merged 13 commits intopython-poetry:masterfrom
maxispeicher:control-parallel-processes
Nov 21, 2021
Merged

Add maximum of workers to config#3516
neersighted merged 13 commits intopython-poetry:masterfrom
maxispeicher:control-parallel-processes

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.

…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.

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.


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=".")

@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.

@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