From 0971d7439d58b093e64e03c65701501d8762026d Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" <1330696+mr-c@users.noreply.github.com> Date: Wed, 9 Nov 2022 16:58:12 +0100 Subject: [PATCH] udocker: use --nobanner as well (#1761) --- cwltool/docker.py | 9 +++++---- tests/test_udocker.py | 16 ++++++++++++++++ tests/wf/cat-tool.cwl | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/cwltool/docker.py b/cwltool/docker.py index 1d7c9f978..2fa688b11 100644 --- a/cwltool/docker.py +++ b/cwltool/docker.py @@ -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: diff --git a/tests/test_udocker.py b/tests/test_udocker.py index f1af3008d..9fd4a8691 100644 --- a/tests/test_udocker.py +++ b/tests/test_udocker.py @@ -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 diff --git a/tests/wf/cat-tool.cwl b/tests/wf/cat-tool.cwl index 4da1fd43a..1b7eb4e19 100644 --- a/tests/wf/cat-tool.cwl +++ b/tests/wf/cat-tool.cwl @@ -5,7 +5,7 @@ cwlVersion: v1.0 hints: DockerRequirement: - dockerPull: docker.io/bash:4.4` + dockerPull: docker.io/bash:4.4 inputs: file1: File