mirror of
https://github.com/wassname/ray.git
synced 2026-06-29 20:35:31 +08:00
[tune] Fix Docs (#1469)
This commit is contained in:
@@ -7,7 +7,6 @@ import json
|
||||
import numpy as np
|
||||
import os
|
||||
import sys
|
||||
import tensorflow as tf
|
||||
|
||||
from ray.tune.result import TrainingResult
|
||||
|
||||
@@ -16,6 +15,12 @@ if sys.version_info[0] == 2:
|
||||
elif sys.version_info[0] == 3:
|
||||
import io as StringIO
|
||||
|
||||
try:
|
||||
import tensorflow as tf
|
||||
except ImportError:
|
||||
tf = None
|
||||
print("Couldn't import TensorFlow - this disables TensorBoard logging.")
|
||||
|
||||
|
||||
class Logger(object):
|
||||
"""Logging interface for ray.tune; specialized implementations follow.
|
||||
@@ -54,6 +59,9 @@ class UnifiedLogger(Logger):
|
||||
def _init(self):
|
||||
self._loggers = []
|
||||
for cls in [_JsonLogger, _TFLogger, _VisKitLogger]:
|
||||
if cls is _TFLogger and tf is None:
|
||||
print("TF not installed - cannot log with {}...".format(cls))
|
||||
continue
|
||||
self._loggers.append(cls(self.config, self.logdir, self.uri))
|
||||
print("Unified logger created with logdir '{}'".format(self.logdir))
|
||||
|
||||
|
||||
@@ -2,14 +2,26 @@ from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
import threading
|
||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||
|
||||
from ray.tune.error import TuneError, TuneManagerError
|
||||
from ray.tune.variant_generator import generate_trials
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
from SimpleHTTPServer import SimpleHTTPRequestHandler
|
||||
from SocketServer import TCPServer as HTTPServer
|
||||
elif sys.version_info[0] == 3:
|
||||
from http.server import SimpleHTTPRequestHandler, HTTPServer
|
||||
|
||||
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.")
|
||||
|
||||
|
||||
class TuneClient(object):
|
||||
"""Client to interact with ongoing Tune experiment.
|
||||
@@ -58,7 +70,7 @@ class TuneClient(object):
|
||||
|
||||
|
||||
def RunnerHandler(runner):
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
class Handler(SimpleHTTPRequestHandler):
|
||||
|
||||
def do_GET(self):
|
||||
content_len = int(self.headers.get('Content-Length'), 0)
|
||||
|
||||
Reference in New Issue
Block a user