Disable dashboard tune module if pandas version is incorrect (#14381)

This commit is contained in:
fyrestone 2021-03-09 10:40:59 +08:00 committed by GitHub
parent 2da58bb021
commit 3616424f10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,13 +9,19 @@ import ray.new_dashboard.modules.tune.tune_consts \
import ray.new_dashboard.utils as dashboard_utils
from ray.new_dashboard.utils import async_loop_forever, rest_response
logger = logging.getLogger(__name__)
try:
from ray.tune import Analysis
from tensorboard import program
except ImportError:
# The `pip install ray` will not install pandas,
# so `from ray.tune import Analysis` may raises
# `AttributeError: module 'pandas' has no attribute 'core'`
# if the pandas version is incorrect.
except (ImportError, AttributeError) as ex:
logger.warning("tune module is not available: %s", ex)
Analysis = None
logger = logging.getLogger(__name__)
routes = dashboard_utils.ClassMethodRouteTable