Skip to content

Commit 3856453

Browse files
committed
set unsafe permissions for temporary directories
Signed-off-by: Steven Hahn <hahnse@ornl.gov>
1 parent 8e693c0 commit 3856453

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

tests/test_helpers.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import tarfile
1414
import os
1515
import io
16+
import subprocess
1617
import sys
1718
import docker
1819
import networkx
@@ -67,13 +68,27 @@ def _install_WfCommons_on_container(container):
6768
raise RuntimeError("Failed to pip install WfCommons on the container")
6869

6970

71+
def recursive_chmod_subprocess(path, permissions):
72+
try:
73+
# Use 'chmod -R' to recursively change permissions
74+
subprocess.check_call(['chmod', '-R', permissions, path])
75+
print(f"Successfully changed permissions to {permissions} recursively for {path} using subprocess.")
76+
except subprocess.CalledProcessError as e:
77+
print(f"Error changing permissions: {e}")
78+
except FileNotFoundError:
79+
# Handle case where 'chmod' command is not found (less common on Linux/macOS)
80+
print("The 'chmod' command was not found. Ensure it's in your system's PATH.")
81+
82+
7083
def _start_docker_container(backend, mounted_dir, working_dir, bin_dir, command=None):
7184
if command is None:
7285
command = ["sleep", "infinity"]
7386
# Pulling the Docker image
7487
client = docker.from_env()
7588
image_name = f"wfcommons/wfcommons-testing-{backend}"
7689

90+
recursive_chmod_subprocess(mounted_dir, '777')
91+
7792
try:
7893
image = client.images.get(image_name)
7994
sys.stderr.write(f"[{backend}] Image '{image_name}' is available locally\n")

wfcommons/wfbench/translator/abstract_translator.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def _copy_binary_files(self, output_folder: pathlib.Path) -> None:
9292
"""
9393
bin_folder = output_folder.joinpath("bin")
9494
bin_folder.mkdir(exist_ok=True)
95+
print("_copy_binary_files...bin_folder: ", bin_folder)
96+
print("_copy_binary_files...wfbench: ", shutil.which("wfbench"))
97+
print("_copy_binary_files...cpu-benchmark: ", shutil.which("cpu-benchmark"))
9598

9699
shutil.copy(shutil.which("wfbench"), bin_folder)
97100
shutil.copy(shutil.which("cpu-benchmark"), bin_folder)

0 commit comments

Comments
 (0)