Browse Source

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

tags/v0.3.0-alpha
ougongchang 6 years ago
parent
commit
add483450b
3 changed files with 5 additions and 4 deletions
  1. +2
    -2
      mindinsight/datavisual/common/exceptions.py
  2. +1
    -1
      mindinsight/datavisual/processors/graph_processor.py
  3. +2
    -1
      tests/utils/tools.py

+ 2
- 2
mindinsight/datavisual/common/exceptions.py View File

@@ -118,8 +118,8 @@ class PluginNotAvailableError(MindInsightException):

class GraphNotExistError(MindInsightException):
"""Can not found the given graph."""
def __init__(self):
error_msg = 'Graph is not exist.'
def __init__(self, error_detail=None):
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,
error_msg,
http_code=400)


+ 1
- 1
mindinsight/datavisual/processors/graph_processor.py View File

@@ -40,7 +40,7 @@ class GraphProcessor(BaseProcessor):
train_job = self._data_manager.get_train_job_by_plugin(train_id, PluginNameEnum.GRAPH.value)
if train_job is None:
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()

if tag is None:


+ 2
- 1
tests/utils/tools.py View File

@@ -59,12 +59,13 @@ def check_loading_done(data_manager, time_limit=15, first_sleep_time=0):
if first_sleep_time > 0:
time.sleep(first_sleep_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
if time_used > time_limit:
break
time.sleep(0.1)
continue
return bool(data_manager.status == DataManagerStatus.DONE.value)


def get_image_tensor_from_bytes(image_string):


Loading…
Cancel
Save