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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. _GENERAL_MASK = 0b00001 << 7
  18. _PARSER_MASK = 0b00010 << 7
  19. _ANALYSER_MASK = 0b00011 << 7
  20. class ProfilerMgrErrors(Enum):
  21. """Enum definition for profiler errors"""
  22. @unique
  23. class ProfilerErrors(ProfilerMgrErrors):
  24. """Profiler error codes."""
  25. # general error code
  26. PARAM_VALUE_ERROR = 0 | _GENERAL_MASK
  27. PATH_ERROR = 1 | _GENERAL_MASK
  28. PARAM_TYPE_ERROR = 2 | _GENERAL_MASK
  29. DIR_NOT_FOUND_ERROR = 3 | _GENERAL_MASK
  30. FILE_NOT_FOUND_ERROR = 4 | _GENERAL_MASK
  31. IO_ERROR = 5 | _GENERAL_MASK
  32. # parser error code
  33. DEVICE_ID_MISMATCH_ERROR = 0 | _PARSER_MASK
  34. RAW_FILE_ERROR = 1 | _PARSER_MASK
  35. STEP_NUM_NOT_SUPPORTED_ERROR = 2 | _PARSER_MASK
  36. JOB_ID_MISMATCH_ERROR = 3 | _PARSER_MASK
  37. # analyser error code
  38. COLUMN_NOT_EXIST_ERROR = 0 | _ANALYSER_MASK
  39. ANALYSER_NOT_EXIST_ERROR = 1 | _ANALYSER_MASK
  40. DEVICE_ID_ERROR = 2 | _ANALYSER_MASK
  41. OP_TYPE_ERROR = 3 | _ANALYSER_MASK
  42. GROUP_CONDITION_ERROR = 4 | _ANALYSER_MASK
  43. SORT_CONDITION_ERROR = 5 | _ANALYSER_MASK
  44. FILTER_CONDITION_ERROR = 6 | _ANALYSER_MASK
  45. COLUMN_NOT_SUPPORT_SORT_ERROR = 7 | _ANALYSER_MASK
  46. PIPELINE_OP_NOT_EXIST_ERROR = 8 | _ANALYSER_MASK
  47. @unique
  48. class ProfilerErrorMsg(Enum):
  49. """Profiler error messages."""
  50. # general error msg
  51. PARAM_VALUE_ERROR = 'Param value error. {}'
  52. PATH_ERROR = 'Path error. {}'
  53. PARAM_TYPE_ERROR = 'Param type error. {}'
  54. DIR_NOT_FOUND_ERROR = 'The dir <{}> not found.'
  55. FILE_NOT_FOUND_ERROR = 'The file <{}> not found.'
  56. IO_ERROR = 'Read or write file fail.'
  57. # parser error msg
  58. DEVICE_ID_MISMATCH_ERROR = 'The device ID mismatch.'
  59. RAW_FILE_ERROR = 'Raw file error. {}'
  60. STEP_NUM_NOT_SUPPORTED_ERROR = 'The step num must be in {}'
  61. JOB_ID_MISMATCH_ERROR = 'The job id in the parameter is not the same as ' \
  62. 'in the training trace file. '
  63. # analyser error msg
  64. COLUMN_NOT_EXIST_ERROR = 'The column {} does not exist.'
  65. ANALYSER_NOT_EXIST_ERROR = 'The analyser {} does not exist.'
  66. DEIVICE_ID_ERROR = 'The device_id in search_condition error, {}'
  67. FILTER_CONDITION_ERROR = 'The filter_condition in search_condition error, {}'
  68. OP_TYPE_ERROR = 'The op_type in search_condition error, {}'
  69. GROUP_CONDITION_ERROR = 'The group_condition in search_condition error, {}'
  70. SORT_CONDITION_ERROR = 'The sort_condition in search_condition error, {}'
  71. COLUMN_NOT_SUPPORT_SORT_ERROR = 'The column {} does not support to sort.'
  72. PIPELINE_OP_NOT_EXIST_ERROR = 'The minddata pipeline operator {} does not exist.'