[tune] Tune onto Logging Module (#2882)

Moves Tune onto logging in Python. Ignores examples and tests.
This commit is contained in:
Richard Liaw
2018-09-16 12:09:36 -07:00
committed by GitHub
parent a8248e8628
commit f372f48bf3
17 changed files with 121 additions and 63 deletions
+6 -3
View File
@@ -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()