Skip to content

Commit 71b8389

Browse files
Merge pull request #135 from wfcommons/makeflow_logger
Improved Dockerized-testing
2 parents 79d6953 + b89be82 commit 71b8389

15 files changed

Lines changed: 92 additions & 43 deletions

tests/test_helpers.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,22 @@ def _install_WfCommons_on_container(container):
5050
tar_data = _make_tarfile_of_wfcommons()
5151
container.put_archive(target_path, tar_data)
5252
# Cleanup files that came from the host
53-
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/build/", stdout=True, stderr=True)
54-
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/*.egg-info/", stdout=True, stderr=True)
53+
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/build/", user="wfcommons", stdout=True, stderr=True)
54+
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/*.egg-info/", user="wfcommons", stdout=True, stderr=True)
5555
# Clean up and force a rebuild of cpu-benchmark (because it may be compiled for the wrong architecture)
56-
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark.o", stdout=True,
56+
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark.o", user="wfcommons", stdout=True,
5757
stderr=True)
58-
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark", stdout=True,
58+
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark", user="wfcommons", stdout=True,
5959
stderr=True)
6060

6161
# Install WfCommons on the container (to install wfbench and cpu-benchmark really)
6262
exit_code, output = container.exec_run("sudo python3 -m pip install . --break-system-packages",
63+
user="wfcommons",
6364
workdir="/tmp/WfCommons", stdout=True, stderr=True)
64-
# print(output.decode())
6565
if exit_code != 0:
66-
raise RuntimeError("Failed to install WfCommons on the container")
66+
print(output.decode())
67+
raise RuntimeError("Failed to pip install WfCommons on the container")
68+
6769

6870
def _start_docker_container(backend, mounted_dir, working_dir, bin_dir, command=None):
6971
if command is None:
@@ -86,6 +88,7 @@ def _start_docker_container(backend, mounted_dir, working_dir, bin_dir, command=
8688
command=command,
8789
volumes={mounted_dir: {'bind': mounted_dir, 'mode': 'rw'}},
8890
working_dir=working_dir,
91+
user="wfcommons",
8992
tty=True,
9093
detach=True
9194
)
@@ -97,22 +100,19 @@ def _start_docker_container(backend, mounted_dir, working_dir, bin_dir, command=
97100
if bin_dir:
98101
sys.stderr.write(f"[{backend}] Copying wfbench and cpu-benchmark...\n")
99102
exit_code, output = container.exec_run(["sh", "-c", "sudo cp -f `which wfbench` " + bin_dir],
103+
user="wfcommons",
100104
stdout=True, stderr=True)
101105
if exit_code != 0:
102106
raise RuntimeError("Failed to copy wfbench script to the bin directory")
103107

104108
exit_code, output = container.exec_run(["sh", "-c", "sudo cp -f `which cpu-benchmark` " + bin_dir],
109+
user="wfcommons",
105110
stdout=True, stderr=True)
106111
if exit_code != 0:
107112
raise RuntimeError("Failed to copy cpu-benchmark executable to the bin directory")
108113
else:
109114
sys.stderr.write(f"[{backend}] Not Copying wfbench and cpu-benchmark...\n")
110115

111-
# Change file permissions
112-
exit_code, output = container.exec_run(["sh", "-c", "sudo chown -R wfcommons:wfcommons "],
113-
stdout=True, stderr=True)
114-
115-
116116
container.backend = backend
117117
return container
118118

tests/translators_loggers/Dockerfile.airflow

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
7777
ENV PATH="$PATH:/home/wfcommons/.local/bin/"
7878

7979
USER wfcommons
80-
WORKDIR /home/wfcommons
80+
WORKDIR /home/wfcommons
81+
# Making this directory world rwx to facilitate testing
82+
RUN chmod -R 777 /home/wfcommons
83+

tests/translators_loggers/Dockerfile.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4242

4343
USER wfcommons
4444
WORKDIR /home/wfcommons
45+
# Making this directory world rwx to facilitate testing
46+
RUN chmod -R 777 /home/wfcommons
4547

tests/translators_loggers/Dockerfile.cwl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4646

4747
USER wfcommons
4848
WORKDIR /home/wfcommons
49+
# Making this directory world rwx to facilitate testing
50+
RUN chmod -R 777 /home/wfcommons
4951

tests/translators_loggers/Dockerfile.dask

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4646

4747
USER wfcommons
4848
WORKDIR /home/wfcommons
49+
# Making this directory world rwx to facilitate testing
50+
RUN chmod -R 777 /home/wfcommons
4951

tests/translators_loggers/Dockerfile.makeflow

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4343

4444
USER wfcommons
4545
WORKDIR /home/wfcommons
46+
# Making this directory world rwx to facilitate testing
47+
RUN chmod -R 777 /home/wfcommons
48+
4649

4750
# Install Miniforge
4851
RUN wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" && \

tests/translators_loggers/Dockerfile.nextflow

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
4545
ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4646
USER wfcommons
4747
WORKDIR /home/wfcommons
48+
# Making this directory world rwx to facilitate testing
49+
RUN chmod -R 777 /home/wfcommons
50+
4851

4952
# Install Nextflow and dependencies
5053
RUN curl -s https://get.nextflow.io | bash && sudo mv ./nextflow /usr/local/bin/

tests/translators_loggers/Dockerfile.parsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4545

4646
USER wfcommons
4747
WORKDIR /home/wfcommons
48+
# Making this directory world rwx to facilitate testing
49+
RUN chmod -R 777 /home/wfcommons
4850

tests/translators_loggers/Dockerfile.pegasus

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
110110

111111
USER wfcommons
112112
WORKDIR /home/wfcommons
113+
# Making this directory world rwx to facilitate testing
114+
RUN chmod -R 777 /home/wfcommons
115+
113116

114117
# Create script to start HTCondor
115118
RUN echo "#!/bin/bash" >> ./start_condor.sh && \

tests/translators_loggers/Dockerfile.pycompss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
5151

5252
USER wfcommons
5353
WORKDIR /home/wfcommons
54+
# Making this directory world rwx to facilitate testing
55+
RUN chmod -R 777 /home/wfcommons
5456

0 commit comments

Comments
 (0)