mirror of
https://github.com/wassname/ray.git
synced 2026-07-02 07:04:46 +08:00
Printing messages to stderr (#2312)
Move core python code onto logging module. Addressing #1884.
This commit is contained in:
@@ -9,6 +9,7 @@ import time
|
||||
|
||||
from ray.services import get_ip_address
|
||||
from ray.services import get_port
|
||||
from ray.services import logger
|
||||
|
||||
|
||||
class LogMonitor(object):
|
||||
@@ -43,7 +44,7 @@ class LogMonitor(object):
|
||||
"LOG_FILENAMES:{}".format(self.node_ip_address),
|
||||
num_current_log_files, -1)
|
||||
for log_filename in new_log_filenames:
|
||||
print("Beginning to track file {}".format(log_filename))
|
||||
logger.info("Beginning to track file {}".format(log_filename))
|
||||
assert log_filename not in self.log_files
|
||||
self.log_files[log_filename] = []
|
||||
|
||||
@@ -83,11 +84,12 @@ class LogMonitor(object):
|
||||
log_filename, "r")
|
||||
except IOError as e:
|
||||
if e.errno == os.errno.EMFILE:
|
||||
print("Warning: Ignoring {} because there are too "
|
||||
"many open files.".format(log_filename))
|
||||
logger.warning(
|
||||
"Warning: Ignoring {} because there are too "
|
||||
"many open files.".format(log_filename))
|
||||
elif e.errno == os.errno.ENOENT:
|
||||
print("Warning: The file {} was not "
|
||||
"found.".format(log_filename))
|
||||
logger.warning("Warning: The file {} was not "
|
||||
"found.".format(log_filename))
|
||||
else:
|
||||
raise e
|
||||
|
||||
|
||||
Reference in New Issue
Block a user