mirror of
https://github.com/wassname/ray.git
synced 2026-07-27 11:26:41 +08:00
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:
@@ -6,6 +6,7 @@ import logging
|
||||
import glob
|
||||
import os
|
||||
import pickle
|
||||
import platform
|
||||
import pandas as pd
|
||||
from six import string_types
|
||||
import shutil
|
||||
@@ -308,7 +309,7 @@ class Trainable:
|
||||
time_this_iter_s=time_this_iter,
|
||||
time_total_s=self._time_total,
|
||||
pid=os.getpid(),
|
||||
hostname=os.uname()[1],
|
||||
hostname=platform.node(),
|
||||
node_ip=self._local_ip,
|
||||
config=self.config,
|
||||
time_since_restore=self._time_since_restore,
|
||||
|
||||
@@ -3,6 +3,7 @@ from collections import deque
|
||||
import copy
|
||||
from datetime import datetime
|
||||
import logging
|
||||
import platform
|
||||
import shutil
|
||||
import uuid
|
||||
import time
|
||||
@@ -42,7 +43,7 @@ class Location:
|
||||
def __str__(self):
|
||||
if not self.pid:
|
||||
return ""
|
||||
elif self.hostname == os.uname()[1]:
|
||||
elif self.hostname == platform.node():
|
||||
return "pid={}".format(self.pid)
|
||||
else:
|
||||
return "{}:{}".format(self.hostname, self.pid)
|
||||
|
||||
Reference in New Issue
Block a user