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

Optimise default value of number-of-workers #659

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion osism/commands/worker.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# SPDX-License-Identifier: Apache-2.0

import multiprocessing
import subprocess

from cliff.command import Command


class Run(Command):
def get_parser(self, prog_name):
if multiprocessing.cpu_count() <= 8:
artificial-intelligence marked this conversation as resolved.
Show resolved Hide resolved
number_of_workers_default = multiprocessing.cpu_count()
else:
number_of_workers_default = 8

parser = super(Run, self).get_parser(prog_name)
parser.add_argument(
"--number-of-workers",
"-n",
default=16,
default=number_of_workers_default,
type=int,
help="Number of workers",
)
Expand Down
3 changes: 2 additions & 1 deletion releasenotes/notes/number-of-workers-f55a3422c0b976cc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ features:
- |
With the new parameter `--number-of-workers` for the worker command, it
is now possible to increase the number of workers that can be used
simultaneously. The value is set to 16 by default.
simultaneously. The value is set to the number of usable CPUs by default.
If the number of usable CPUs is higher than 8, the default value is 8.