Skip to content

Commit

Permalink
udocker: use --nobanner as well (#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c authored Nov 9, 2022
1 parent 6af9320 commit 0971d74
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cwltool/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,11 @@ def create_runtime(
any_path_okay = self.builder.get_requirement("DockerRequirement")[1] or False
user_space_docker_cmd = runtimeContext.user_space_docker_cmd
if user_space_docker_cmd:
if "udocker" in user_space_docker_cmd and not runtimeContext.debug:
runtime = [user_space_docker_cmd, "--quiet", "run"]
# udocker 1.1.1 will output diagnostic messages to stdout
# without this
if "udocker" in user_space_docker_cmd:
if runtimeContext.debug:
runtime = [user_space_docker_cmd, "run", "--nobanner"]
else:
runtime = [user_space_docker_cmd, "--quiet", "run", "--nobanner"]
else:
runtime = [user_space_docker_cmd, "run"]
elif runtimeContext.podman:
Expand Down
16 changes: 16 additions & 0 deletions tests/test_udocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,19 @@ def test_udocker_should_display_memory_usage(udocker: str, tmp_path: Path) -> No

assert "completed success" in stderr, stderr
assert "Max memory" in stderr, stderr


@pytest.mark.skipif(not LINUX, reason="LINUX only")
def test_udocker_nobanner(udocker: str, tmp_path: Path) -> None:
"""Avoid the banner when running udocker."""
with working_directory(tmp_path):
error_code, stdout, stderr = get_main_output(
[
"--user-space-docker-cmd=" + udocker,
get_data("tests/wf/cat-tool.cwl"),
get_data("tests/wf/wc-job.json"),
]
)

assert "completed success" in stderr, stderr
assert "sha1$327fc7aedf4f6b69a42a7c8b808dc5a7aff61376" in stdout, stdout
2 changes: 1 addition & 1 deletion tests/wf/cat-tool.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cwlVersion: v1.0

hints:
DockerRequirement:
dockerPull: docker.io/bash:4.4`
dockerPull: docker.io/bash:4.4

inputs:
file1: File
Expand Down

0 comments on commit 0971d74

Please sign in to comment.