Browse Source

!1219 Catch the host cpu data exception when returned data row to restful api

From: @gzhcv
Reviewed-by: @yelihua,@ouwenchang
Signed-off-by: @ouwenchang
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 4 years ago
parent
commit
a2944152bd
2 changed files with 15 additions and 4 deletions
  1. +14
    -3
      mindinsight/profiler/analyser/cpu_analyser.py
  2. +1
    -1
      mindinsight/profiler/common/validator/validate.py

+ 14
- 3
mindinsight/profiler/analyser/cpu_analyser.py View File

@@ -15,6 +15,9 @@
"""The cpu base analyser.""" """The cpu base analyser."""
from mindinsight.profiler.analyser.gpu_analyser import GpuAnalyser from mindinsight.profiler.analyser.gpu_analyser import GpuAnalyser
from mindinsight.profiler.common.validator import validate from mindinsight.profiler.common.validator import validate
from mindinsight.profiler.common.exceptions.exceptions import ProfilerRawFileException
from mindinsight.profiler.common.log import logger as log



class CpuOpTypeAnalyser(GpuAnalyser): class CpuOpTypeAnalyser(GpuAnalyser):
"""Cpu operation type analyser.""" """Cpu operation type analyser."""
@@ -32,7 +35,11 @@ class CpuOpTypeAnalyser(GpuAnalyser):
Returns: Returns:
list, the converted data. list, the converted data.
""" """
return [row[0], int(row[1]), int(row[2]), float(row[3]), float(row[4]), float(row[5])*100]
try:
return [row[0], int(row[1]), int(row[2]), float(row[3]), float(row[4]), float(row[5])*100]
except IndexError as err:
log.exception(err)
raise ProfilerRawFileException('failed to get HOST CPU operator type data.')




class CpuOpInfoAnalyser(GpuAnalyser): class CpuOpInfoAnalyser(GpuAnalyser):
@@ -51,5 +58,9 @@ class CpuOpInfoAnalyser(GpuAnalyser):
Returns: Returns:
list, the converted data. list, the converted data.
""" """
return [row[0], row[1], row[2], row[3], int(row[4]), float(row[5]),
float(row[6]), float(row[7]), row[8]]
try:
return [row[0], row[1], row[2], row[3], int(row[4]), float(row[5]),
float(row[6]), float(row[7]), row[8]]
except IndexError as err:
log.exception(err)
raise ProfilerRawFileException('failed to get HOST CPU operator detail data.')

+ 1
- 1
mindinsight/profiler/common/validator/validate.py View File

@@ -35,7 +35,7 @@ GPU_DETAIL_COL = ["op_side", "op_type", "op_name", "op_full_name",
"op_occurrences", "op_total_time", "op_avg_time", "op_occurrences", "op_total_time", "op_avg_time",
"proportion", "cuda_activity_cost_time", "cuda_activity_call_count"] "proportion", "cuda_activity_cost_time", "cuda_activity_call_count"]
CPU_TYPE_COL = ["op_type", "type_occurrences", "execution_frequency", "total_compute_time", CPU_TYPE_COL = ["op_type", "type_occurrences", "execution_frequency", "total_compute_time",
"avg_time", "percent"]
"avg_time", "total_time_proportion"]
CPU_DETAIL_COL = ["op_side", "op_type", "op_name", "full_op_name", "op_occurrences", CPU_DETAIL_COL = ["op_side", "op_type", "op_name", "full_op_name", "op_occurrences",
"op_total_time", "op_avg_time", "total_time_proportion", "subgraph"] "op_total_time", "op_avg_time", "total_time_proportion", "subgraph"]
MINDDATA_PIPELINE_COL = [ MINDDATA_PIPELINE_COL = [


Loading…
Cancel
Save