mirror of
https://github.com/wassname/ray.git
synced 2026-09-09 11:32:43 +08:00
[docker] Run profiling without sudo (#10388)
* fix profiling for docker * small fixes * use name * do not import pwd on windows
This commit is contained in:
@@ -73,9 +73,10 @@ class ReporterAgent(dashboard_utils.DashboardAgentModule,
|
||||
duration = request.duration
|
||||
profiling_file_path = os.path.join(ray.utils.get_ray_temp_dir(),
|
||||
"{}_profiling.txt".format(pid))
|
||||
sudo = "sudo" if ray.utils.get_user() != "root" else ""
|
||||
process = subprocess.Popen(
|
||||
"sudo $(which py-spy) record -o {} -p {} -d {} -f speedscope"
|
||||
.format(profiling_file_path, pid, duration),
|
||||
(f"{sudo} $(which py-spy) record -o {profiling_file_path} -p {pid}"
|
||||
f" -d {duration} -f speedscope"),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
shell=True)
|
||||
|
||||
Reference in New Issue
Block a user