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.

exceptions.py 7.2 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. # Copyright 2019 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. """Definition of error code and relative messages in lineage module."""
  16. from mindinsight.utils.exceptions import MindInsightException
  17. from mindinsight.lineagemgr.common.exceptions.error_code import LineageErrors, LineageErrorMsg
  18. class LineageParamTypeError(MindInsightException):
  19. """The parameter type error in lineage module."""
  20. def __init__(self, msg):
  21. super(LineageParamTypeError, self).__init__(
  22. error=LineageErrors.PARAM_TYPE_ERROR,
  23. message=LineageErrorMsg.PARAM_TYPE_ERROR.value.format(msg)
  24. )
  25. class LineageParamValueError(MindInsightException):
  26. """The parameter value error in lineage module."""
  27. def __init__(self, msg):
  28. super(LineageParamValueError, self).__init__(
  29. error=LineageErrors.PARAM_VALUE_ERROR,
  30. message=LineageErrorMsg.PARAM_VALUE_ERROR.value.format(msg)
  31. )
  32. class LineageParamMissingError(MindInsightException):
  33. """The parameter missing error in lineage module."""
  34. def __init__(self, msg):
  35. super(LineageParamMissingError, self).__init__(
  36. error=LineageErrors.PARAM_MISSING_ERROR,
  37. message=LineageErrorMsg.PARAM_MISSING_ERROR.value.format(msg)
  38. )
  39. class LineageParamRunContextError(MindInsightException):
  40. """The input parameter run_context error in lineage module."""
  41. def __init__(self, msg):
  42. super(LineageParamRunContextError, self).__init__(
  43. error=LineageErrors.PARAM_RUN_CONTEXT_ERROR,
  44. message=LineageErrorMsg.PARAM_RUN_CONTEXT_ERROR.value.format(msg)
  45. )
  46. class LineageGetModelFileError(MindInsightException):
  47. """The get model file error in lineage module."""
  48. def __init__(self, msg):
  49. super(LineageGetModelFileError, self).__init__(
  50. error=LineageErrors.LINEAGE_GET_MODEL_FILE_ERROR,
  51. message=LineageErrorMsg.LINEAGE_GET_MODEL_FILE_ERROR.value.format(msg)
  52. )
  53. class LineageSearchModelParamError(MindInsightException):
  54. """The lineage search model param error."""
  55. def __init__(self, msg):
  56. super(LineageSearchModelParamError, self).__init__(
  57. error=LineageErrors.LINEAGE_PARAM_NOT_SUPPORT_ERROR,
  58. message=LineageErrorMsg.LINEAGE_PARAM_NOT_SUPPORT_ERROR.value.format(msg)
  59. )
  60. class LineageSummaryAnalyzeException(MindInsightException):
  61. """The summary analyze error in lineage module."""
  62. def __init__(self, msg=None):
  63. if msg is None:
  64. msg = ''
  65. super(LineageSummaryAnalyzeException, self).__init__(
  66. error=LineageErrors.SUMMARY_ANALYZE_ERROR,
  67. message=LineageErrorMsg.SUMMARY_ANALYZE_ERROR.value.format(msg)
  68. )
  69. class LineageVerificationException(MindInsightException):
  70. """The summary verification error in lineage module."""
  71. def __init__(self, msg):
  72. super(LineageVerificationException, self).__init__(
  73. error=LineageErrors.SUMMARY_VERIFICATION_ERROR,
  74. message=LineageErrorMsg.SUMMARY_VERIFICATION_ERROR.value.format(msg)
  75. )
  76. class LineageLogError(MindInsightException):
  77. """The lineage collector error."""
  78. def __init__(self, msg):
  79. super(LineageLogError, self).__init__(
  80. error=LineageErrors.LOG_LINEAGE_INFO_ERROR,
  81. message=LineageErrorMsg.LOG_LINEAGE_INFO_ERROR.value.format(msg)
  82. )
  83. class LineageEventNotExistException(MindInsightException):
  84. """The querier error in lineage module."""
  85. def __init__(self):
  86. super(LineageEventNotExistException, self).__init__(
  87. error=LineageErrors.EVENT_NOT_EXIST_ERROR,
  88. message=LineageErrorMsg.EVENT_NOT_EXIST_ERROR.value
  89. )
  90. class LineageQuerierParamException(MindInsightException):
  91. """The querier error in lineage module."""
  92. def __init__(self, *msg):
  93. super(LineageQuerierParamException, self).__init__(
  94. error=LineageErrors.QUERIER_PARAM_ERROR,
  95. message=LineageErrorMsg.QUERIER_PARAM_ERROR.value.format(*msg)
  96. )
  97. class LineageSummaryParseException(MindInsightException):
  98. """The querier error in lineage module."""
  99. def __init__(self):
  100. super(LineageSummaryParseException, self).__init__(
  101. error=LineageErrors.SUMMARY_PARSE_FAIL_ERROR,
  102. message=LineageErrorMsg.SUMMARY_PARSE_FAIL_ERROR.value
  103. )
  104. class LineageEventFieldNotExistException(MindInsightException):
  105. """The querier error in lineage module."""
  106. def __init__(self, msg):
  107. super(LineageEventFieldNotExistException, self).__init__(
  108. error=LineageErrors.EVENT_FIELD_NOT_EXIST_ERROR,
  109. message=LineageErrorMsg.EVENT_FIELD_NOT_EXIST_ERROR.value.format(msg)
  110. )
  111. class LineageParamSummaryPathError(MindInsightException):
  112. """The lineage parameter summary path error."""
  113. def __init__(self, msg):
  114. super(LineageParamSummaryPathError, self).__init__(
  115. error=LineageErrors.LINEAGE_PARAM_SUMMARY_PATH_ERROR,
  116. message=LineageErrorMsg.LINEAGE_PARAM_SUMMARY_PATH_ERROR.value.format(msg)
  117. )
  118. class LineageQuerySummaryDataError(MindInsightException):
  119. """Query summary data error in lineage module."""
  120. def __init__(self, msg):
  121. super(LineageQuerySummaryDataError, self).__init__(
  122. error=LineageErrors.LINEAGE_SUMMARY_DATA_ERROR,
  123. message=LineageErrorMsg.LINEAGE_SUMMARY_DATA_ERROR.value.format(msg)
  124. )
  125. class LineageFileNotFoundError(MindInsightException):
  126. """Summary file not found in lineage module."""
  127. def __init__(self, msg):
  128. super(LineageFileNotFoundError, self).__init__(
  129. error=LineageErrors.LINEAGE_FILE_NOT_FOUND_ERROR,
  130. message=LineageErrorMsg.LINEAGE_FILE_NOT_FOUND_ERROR.value.format(msg)
  131. )
  132. class LineageDirNotExistError(MindInsightException):
  133. """Directory not exist in lineage module."""
  134. def __init__(self, msg):
  135. super(LineageDirNotExistError, self).__init__(
  136. error=LineageErrors.LINEAGE_DIR_NOT_EXIST_ERROR,
  137. message=LineageErrorMsg.LINEAGE_DIR_NOT_EXIST_ERROR.value.format(msg)
  138. )
  139. class LineageSearchConditionParamError(MindInsightException):
  140. """Search condition param is invalid in lineage module."""
  141. def __init__(self, msg):
  142. super(LineageSearchConditionParamError, self).__init__(
  143. error=LineageErrors.LINEAGE_SEARCH_CONDITION_PARAM_ERROR,
  144. message=LineageErrorMsg.LINEAGE_SEARCH_CONDITION_PARAM_ERROR.value.format(msg)
  145. )

MindInsight为MindSpore提供了简单易用的调优调试能力。在训练过程中,可以将标量、张量、图像、计算图、模型超参、训练耗时等数据记录到文件中,通过MindInsight可视化页面进行查看及分析。

Contributors (1)