Change /tmp to platform-specific temporary directory (#7529)

This commit is contained in:
mehrdadn
2020-03-16 18:10:14 -07:00
committed by GitHub
parent 797e6cfc2a
commit a0700e2f86
27 changed files with 289 additions and 80 deletions
+7 -2
View File
@@ -7,6 +7,7 @@ import time
import datetime
import grpc
import subprocess
import sys
from concurrent import futures
import ray
@@ -30,7 +31,7 @@ class ReporterServer(reporter_pb2_grpc.ReporterServiceServicer):
def GetProfilingStats(self, request, context):
pid = request.pid
duration = request.duration
profiling_file_path = os.path.join("/tmp/ray/",
profiling_file_path = os.path.join(ray.utils.get_ray_temp_dir(),
"{}_profiling.txt".format(pid))
process = subprocess.Popen(
"sudo $(which py-spy) record -o {} -p {} -d {} -f speedscope"
@@ -127,7 +128,11 @@ class Reporter:
@staticmethod
def get_disk_usage():
return {x: psutil.disk_usage(x) for x in ["/", "/tmp"]}
dirs = [
os.environ["USERPROFILE"] if sys.platform == "win32" else os.sep,
ray.utils.get_user_temp_dir(),
]
return {x: psutil.disk_usage(x) for x in dirs}
@staticmethod
def get_workers():