提交 9e0d7cd5 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!128 raise graph not exist when can not find graph by the given tag

Merge pull request !128 from ougongchang/fixbug_exception
...@@ -118,8 +118,8 @@ class PluginNotAvailableError(MindInsightException): ...@@ -118,8 +118,8 @@ class PluginNotAvailableError(MindInsightException):
class GraphNotExistError(MindInsightException): class GraphNotExistError(MindInsightException):
"""Can not found the given graph.""" """Can not found the given graph."""
def __init__(self): def __init__(self, error_detail=None):
error_msg = 'Graph is not exist.' error_msg = 'Graph is not exist.' if error_detail is None else f'Graph is not exist. Detail: {error_detail}'
super(GraphNotExistError, self).__init__(DataVisualErrors.GRAPH_NOT_EXIST, super(GraphNotExistError, self).__init__(DataVisualErrors.GRAPH_NOT_EXIST,
error_msg, error_msg,
http_code=400) http_code=400)
......
...@@ -40,7 +40,7 @@ class GraphProcessor(BaseProcessor): ...@@ -40,7 +40,7 @@ class GraphProcessor(BaseProcessor):
train_job = self._data_manager.get_train_job_by_plugin(train_id, PluginNameEnum.GRAPH.value) train_job = self._data_manager.get_train_job_by_plugin(train_id, PluginNameEnum.GRAPH.value)
if train_job is None: if train_job is None:
raise exceptions.TrainJobNotExistError() raise exceptions.TrainJobNotExistError()
if not train_job['tags']: if not train_job['tags'] or (tag is not None and tag not in train_job['tags']):
raise exceptions.GraphNotExistError() raise exceptions.GraphNotExistError()
if tag is None: if tag is None:
......
...@@ -59,12 +59,13 @@ def check_loading_done(data_manager, time_limit=15, first_sleep_time=0): ...@@ -59,12 +59,13 @@ def check_loading_done(data_manager, time_limit=15, first_sleep_time=0):
if first_sleep_time > 0: if first_sleep_time > 0:
time.sleep(first_sleep_time) time.sleep(first_sleep_time)
start_time = time.time() start_time = time.time()
while data_manager.status != DataManagerStatus.DONE.value: while data_manager.status not in (DataManagerStatus.DONE.value, DataManagerStatus.INVALID.value):
time_used = time.time() - start_time time_used = time.time() - start_time
if time_used > time_limit: if time_used > time_limit:
break break
time.sleep(0.1) time.sleep(0.1)
continue continue
return bool(data_manager.status == DataManagerStatus.DONE.value)
def get_image_tensor_from_bytes(image_string): def get_image_tensor_from_bytes(image_string):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册