Change os.uname()[1] and socket.gethostname() to the portable and faster platform.node_ip() (#8839)

Co-authored-by: Mehrdad <noreply@github.com>
This commit is contained in:
mehrdadn
2020-06-08 21:29:46 -07:00
committed by GitHub
parent d2ef29f0d2
commit f93bb008bb
15 changed files with 31 additions and 27 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ import traceback
import time
import datetime
import grpc
import socket
import platform
import subprocess
import sys
from concurrent import futures
@@ -92,7 +92,7 @@ class Reporter:
"""Initialize the reporter object."""
self.cpu_counts = (psutil.cpu_count(), psutil.cpu_count(logical=False))
self.ip = ray.services.get_node_ip_address()
self.hostname = socket.gethostname()
self.hostname = platform.node()
_ = psutil.cpu_percent() # For initialization
@@ -252,7 +252,7 @@ if __name__ == "__main__":
args.redis_address, password=args.redis_password)
traceback_str = ray.utils.format_error_message(traceback.format_exc())
message = ("The reporter on node {} failed with the following "
"error:\n{}".format(socket.gethostname(), traceback_str))
"error:\n{}".format(platform.node(), traceback_str))
ray.utils.push_error_to_driver_through_redis(
redis_client, ray_constants.REPORTER_DIED_ERROR, message)
raise e