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
co-authored by Mehrdad
parent d2ef29f0d2
commit f93bb008bb
15 changed files with 31 additions and 27 deletions
+2 -1
View File
@@ -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,
+2 -1
View File
@@ -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)