You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

error_code.py 3.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # Copyright 2020 Huawei Technologies Co., Ltd
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # ============================================================================
  15. """Profiler error code and messages."""
  16. from enum import unique, Enum
  17. from mindinsight.utils.constant import ProfilerMgrErrors
  18. _GENERAL_MASK = 0b00001 << 7
  19. _PARSER_MASK = 0b00010 << 7
  20. _ANALYSER_MASK = 0b00011 << 7
  21. @unique
  22. class ProfilerErrors(ProfilerMgrErrors):
  23. """Profiler error codes."""
  24. # general error code
  25. PARAM_VALUE_ERROR = 0 | _GENERAL_MASK
  26. PATH_ERROR = 1 | _GENERAL_MASK
  27. PARAM_TYPE_ERROR = 2 | _GENERAL_MASK
  28. DIR_NOT_FOUND_ERROR = 3 | _GENERAL_MASK
  29. FILE_NOT_FOUND_ERROR = 4 | _GENERAL_MASK
  30. IO_ERROR = 5 | _GENERAL_MASK
  31. # parser error code
  32. DEVICE_ID_MISMATCH_ERROR = 0 | _PARSER_MASK
  33. RAW_FILE_ERROR = 1 | _PARSER_MASK
  34. STEP_NUM_NOT_SUPPORTED_ERROR = 2 | _PARSER_MASK
  35. JOB_ID_MISMATCH_ERROR = 3 | _PARSER_MASK
  36. # analyser error code
  37. COLUMN_NOT_EXIST_ERROR = 0 | _ANALYSER_MASK
  38. ANALYSER_NOT_EXIST_ERROR = 1 | _ANALYSER_MASK
  39. DEVICE_ID_ERROR = 2 | _ANALYSER_MASK
  40. OP_TYPE_ERROR = 3 | _ANALYSER_MASK
  41. GROUP_CONDITION_ERROR = 4 | _ANALYSER_MASK
  42. SORT_CONDITION_ERROR = 5 | _ANALYSER_MASK
  43. FILTER_CONDITION_ERROR = 6 | _ANALYSER_MASK
  44. COLUMN_NOT_SUPPORT_SORT_ERROR = 7 | _ANALYSER_MASK
  45. PIPELINE_OP_NOT_EXIST_ERROR = 8 | _ANALYSER_MASK
  46. @unique
  47. class ProfilerErrorMsg(Enum):
  48. """Profiler error messages."""
  49. # general error msg
  50. PARAM_VALUE_ERROR = 'Param value error. {}'
  51. PATH_ERROR = 'Path error. {}'
  52. PARAM_TYPE_ERROR = 'Param type error. {}'
  53. DIR_NOT_FOUND_ERROR = 'The dir <{}> not found.'
  54. FILE_NOT_FOUND_ERROR = 'The file <{}> not found.'
  55. IO_ERROR = 'Read or write file fail.'
  56. # parser error msg
  57. DEVICE_ID_MISMATCH_ERROR = 'The device ID mismatch.'
  58. RAW_FILE_ERROR = 'Raw file error. {}'
  59. STEP_NUM_NOT_SUPPORTED_ERROR = 'The step num must be in {}'
  60. JOB_ID_MISMATCH_ERROR = 'The job id in the parameter is not the same as ' \
  61. 'in the training trace file. '
  62. # analyser error msg
  63. COLUMN_NOT_EXIST_ERROR = 'The column {} does not exist.'
  64. ANALYSER_NOT_EXIST_ERROR = 'The analyser {} does not exist.'
  65. DEIVICE_ID_ERROR = 'The device_id in search_condition error, {}'
  66. FILTER_CONDITION_ERROR = 'The filter_condition in search_condition error, {}'
  67. OP_TYPE_ERROR = 'The op_type in search_condition error, {}'
  68. GROUP_CONDITION_ERROR = 'The group_condition in search_condition error, {}'
  69. SORT_CONDITION_ERROR = 'The sort_condition in search_condition error, {}'
  70. COLUMN_NOT_SUPPORT_SORT_ERROR = 'The column {} does not support to sort.'
  71. PIPELINE_OP_NOT_EXIST_ERROR = 'The minddata pipeline operator {} does not exist.'