Skip to content

Commit

Permalink
Merge pull request #181 from opensafely-core/fix-cpus-arg
Browse files Browse the repository at this point in the history
fix s/--cpu/--cpus/
  • Loading branch information
bloodearnest authored Jan 13, 2023
2 parents d2bc101 + 59d8442 commit 3f70d3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions opensafely/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def add_arguments(parser):
default=config.DEFAULT_JOB_MEMORY_LIMIT,
)
parser.add_argument(
"--cpu",
"--cpus",
type=int,
help=f"The per-job cpu limit. How many cpus the job can use. Defaults to {config.DEFAULT_JOB_CPU_COUNT}",
default=config.DEFAULT_JOB_CPU_COUNT,
Expand Down Expand Up @@ -67,7 +67,7 @@ def main(
entrypoint=None,
env=[],
user=None,
cpu=None,
cpus=None,
memory=None,
verbose=False,
cmd_args=[],
Expand Down Expand Up @@ -102,8 +102,8 @@ def main(
if entrypoint:
docker_args.append(f"--entrypoint={entrypoint}")

if cpu:
docker_args.append(f"--cpu={cpu}")
if cpus:
docker_args.append(f"--cpus={cpus}")

if memory:
docker_args.append(f"--memory={memory}")
Expand Down
12 changes: 6 additions & 6 deletions tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_execute_main_args(run, no_user):
f"--volume={pathlib.Path.cwd()}://workspace",
"--env",
"OPENSAFELY_BACKEND=expectations",
"--cpu=2.0",
"--cpus=2.0",
"--memory=4G",
"ghcr.io/opensafely-core/databuilder:v1",
"foo",
Expand All @@ -44,7 +44,7 @@ def test_execute_main_entrypoint(run, no_user):
"--env",
"OPENSAFELY_BACKEND=expectations",
"--entrypoint=/entrypoint",
"--cpu=2.0",
"--cpus=2.0",
"--memory=4G",
"ghcr.io/opensafely-core/databuilder:v1",
],
Expand All @@ -71,7 +71,7 @@ def test_execute_main_env(run, no_user):
"BAR",
"--env",
"BAZ=1",
"--cpu=2.0",
"--cpus=2.0",
"--memory=4G",
"ghcr.io/opensafely-core/databuilder:v1",
],
Expand All @@ -96,7 +96,7 @@ def test_execute_main_user_cli_arg_overrides(default, run, monkeypatch):
f"--volume={pathlib.Path.cwd()}://workspace",
"--env",
"OPENSAFELY_BACKEND=expectations",
"--cpu=2.0",
"--cpus=2.0",
"--memory=4G",
"ghcr.io/opensafely-core/databuilder:v1",
],
Expand All @@ -119,7 +119,7 @@ def test_execute_main_user_linux_disble(run, monkeypatch):
f"--volume={pathlib.Path.cwd()}://workspace",
"--env",
"OPENSAFELY_BACKEND=expectations",
"--cpu=2.0",
"--cpus=2.0",
"--memory=4G",
"ghcr.io/opensafely-core/databuilder:v1",
],
Expand All @@ -144,7 +144,7 @@ def test_execute_main_stata_license(run, monkeypatch, no_user):
"OPENSAFELY_BACKEND=expectations",
"--env",
"STATA_LICENSE",
"--cpu=2.0",
"--cpus=2.0",
"--memory=4G",
"ghcr.io/opensafely-core/stata-mp",
"analysis.do",
Expand Down

0 comments on commit 3f70d3e

Please sign in to comment.