mirror of
https://github.com/wassname/ray.git
synced 2026-07-23 13:10:11 +08:00
Change /tmp to platform-specific temporary directory (#7529)
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user