mirror of
https://github.com/wassname/ray.git
synced 2026-07-19 11:27:32 +08:00
[tune] Tune onto Logging Module (#2882)
Moves Tune onto logging in Python. Ignores examples and tests.
This commit is contained in:
@@ -3,6 +3,7 @@ from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
import logging
|
||||
import sys
|
||||
import threading
|
||||
|
||||
@@ -15,12 +16,14 @@ if sys.version_info[0] == 2:
|
||||
elif sys.version_info[0] == 3:
|
||||
from http.server import SimpleHTTPRequestHandler, HTTPServer
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
import requests # `requests` is not part of stdlib.
|
||||
except ImportError:
|
||||
requests = None
|
||||
print("Couldn't import `requests` library. Be sure to install it on"
|
||||
" the client side.")
|
||||
logger.exception("Couldn't import `requests` library. "
|
||||
"Be sure to install it on the client side.")
|
||||
|
||||
|
||||
class TuneClient(object):
|
||||
@@ -149,7 +152,7 @@ class TuneServer(threading.Thread):
|
||||
threading.Thread.__init__(self)
|
||||
self._port = port if port else self.DEFAULT_PORT
|
||||
address = ('localhost', self._port)
|
||||
print("Starting Tune Server...")
|
||||
logger.info("Starting Tune Server...")
|
||||
self._server = HTTPServer(address, RunnerHandler(runner))
|
||||
self.start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user