mirror of
https://github.com/wassname/ray.git
synced 2026-07-02 05:52:36 +08:00
[tune] Tune onto Logging Module (#2882)
Moves Tune onto logging in Python. Ignores examples and tests.
This commit is contained in:
@@ -2,14 +2,16 @@ from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
import logging
|
||||
import time
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
from ray.tune import TuneError
|
||||
from ray.tune.trainable import Trainable
|
||||
from ray.tune.result import TIMESTEPS_TOTAL
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class StatusReporter(object):
|
||||
"""Object passed into your main() that you can report status through.
|
||||
@@ -74,7 +76,7 @@ class _RunnerThread(threading.Thread):
|
||||
self._entrypoint(*self._entrypoint_args)
|
||||
except Exception as e:
|
||||
self._status_reporter._error = e
|
||||
print("Runner thread raised: {}".format(traceback.format_exc()))
|
||||
logger.exception("Runner Thread raised error.")
|
||||
raise e
|
||||
finally:
|
||||
self._status_reporter._done = True
|
||||
|
||||
Reference in New Issue
Block a user