Skip to content

Commit

Permalink
Optimise default value of number-of-workers (#659)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <berendt@osism.tech>
  • Loading branch information
berendt committed Oct 30, 2023
1 parent 8de4c4c commit e2b02bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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:
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.

0 comments on commit e2b02bb

Please sign in to comment.