@@ -40,20 +40,39 @@ def _install_WfCommons_on_container(container):
4040 tar_data = _make_tarfile_of_wfcommons ()
4141 container .put_archive (target_path , tar_data )
4242 # Cleanup files that came from the host
43- exit_code , output = container .exec_run ("sudo /bin/rm -rf /tmp/WfCommons/build/" , stdout = True , stderr = True )
44- exit_code , output = container .exec_run ("sudo /bin/rm -rf /tmp/WfCommons/*.egg-info/" , stdout = True , stderr = True )
43+ exit_code , output = container .exec_run ("/bin/rm -rf /tmp/WfCommons/build/" , user = "root " , stdout = True , stderr = True )
44+ exit_code , output = container .exec_run ("/bin/rm -rf /tmp/WfCommons/*.egg-info/" , user = "root " , stdout = True , stderr = True )
4545 # Clean up and force a rebuild of cpu-benchmark (because it may be compiled for the wrong architecture)
46- exit_code , output = container .exec_run ("sudo /bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark.o" , stdout = True ,
46+ exit_code , output = container .exec_run ("/bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark.o" , user = "root " , stdout = True ,
4747 stderr = True )
48- exit_code , output = container .exec_run ("sudo /bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark" , stdout = True ,
48+ exit_code , output = container .exec_run ("/bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark" , user = "root " , stdout = True ,
4949 stderr = True )
5050
5151 # Install WfCommons on the container (to install wfbench and cpu-benchmark really)
52- exit_code , output = container .exec_run ("sudo python3 -m pip install . --break-system-packages" ,
52+ exit_code , output = container .exec_run ("python3 -m pip install . --break-system-packages" ,
53+ user = "root" ,
5354 workdir = "/tmp/WfCommons" , stdout = True , stderr = True )
54- # print(output.decode())
5555 if exit_code != 0 :
56- raise RuntimeError ("Failed to install WfCommons on the container" )
56+ print (output .decode ())
57+ raise RuntimeError ("Failed to pip install WfCommons on the container" )
58+
59+ # Copy the ~/.local directory to /home/wfcommons/, because the path
60+ # is /home/wfcommons (because this current Docker user may be unknown a priori)
61+ # This is hack, and requires that the /home/wfcommons directory be world-read-write-exec,
62+ # but who cares, these are containers!
63+
64+ # exit_code, output = container.exec_run(
65+ # ["sh", "-c", "whoami"],
66+ # stdout=True, stderr=True)
67+ # print(f"WHOAMI: {output.decode()}")
68+ # exit_code, output = container.exec_run(
69+ # ["sh", "-c", "ls /home/wfcommons/.local"],
70+ # stdout=True, stderr=True)
71+ # print(f"LS /home/wfcommons/.local : {output.decode()}")
72+ # exit_code, output = container.exec_run(
73+ # ["sh", "-c", "cp -r /.local /home/wfcommons/"],
74+ # stdout=True, stderr=True)
75+
5776
5877def _start_docker_container (backend , mounted_dir , working_dir , bin_dir , command = None ):
5978 if command is None :
0 commit comments