@@ -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
6870def _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
0 commit comments