Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorboard/compat/tensorflow_stub/error_codes.py: 100%

18 statements  

« prev     ^ index     » next       coverage.py v7.4.0, created at 2024-01-03 07:57 +0000

1# Copyright 2018 The TensorFlow Authors. All Rights Reserved. 

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 

16# Contains error codes defined in tensorflow/core/lib/core/error_codes.proto 

17 

18# Not an error; returned on success 

19OK = 0 

20 

21# The operation was cancelled (typically by the caller). 

22CANCELLED = 1 

23 

24""" 

25Unknown error. An example of where this error may be returned is 

26if a Status value received from another address space belongs to 

27an error-space that is not known in this address space. Also 

28errors raised by APIs that do not return enough error information 

29may be converted to this error. 

30""" 

31UNKNOWN = 2 

32 

33""" 

34Client specified an invalid argument. Note that this differs 

35from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments 

36that are problematic regardless of the state of the system 

37(e.g., a malformed file name). 

38""" 

39INVALID_ARGUMENT = 3 

40 

41""" 

42Deadline expired before operation could complete. For operations 

43that change the state of the system, this error may be returned 

44even if the operation has completed successfully. For example, a 

45successful response from a server could have been delayed long 

46enough for the deadline to expire. 

47""" 

48DEADLINE_EXCEEDED = 4 

49 

50""" 

51Some requested entity (e.g., file or directory) was not found. 

52For privacy reasons, this code *may* be returned when the client 

53does not have the access right to the entity. 

54""" 

55NOT_FOUND = 5 

56 

57""" 

58Some entity that we attempted to create (e.g., file or directory) 

59already exists. 

60""" 

61ALREADY_EXISTS = 6 

62 

63""" 

64The caller does not have permission to execute the specified 

65operation. PERMISSION_DENIED must not be used for rejections 

66caused by exhausting some resource (use RESOURCE_EXHAUSTED 

67instead for those errors). PERMISSION_DENIED must not be 

68used if the caller can not be identified (use UNAUTHENTICATED 

69instead for those errors). 

70""" 

71PERMISSION_DENIED = 7 

72 

73""" 

74Some resource has been exhausted, perhaps a per-user quota, or 

75perhaps the entire file system is out of space. 

76""" 

77RESOURCE_EXHAUSTED = 8 

78 

79""" 

80Operation was rejected because the system is not in a state 

81required for the operation's execution. For example, directory 

82to be deleted may be non-empty, an rmdir operation is applied to 

83a non-directory, etc. 

84A litmus test that may help a service implementor in deciding 

85between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: 

86(a) Use UNAVAILABLE if the client can retry just the failing call. 

87(b) Use ABORTED if the client should retry at a higher-level 

88 (e.g., restarting a read-modify-write sequence). 

89(c) Use FAILED_PRECONDITION if the client should not retry until 

90 the system state has been explicitly fixed. E.g., if an "rmdir" 

91 fails because the directory is non-empty, FAILED_PRECONDITION 

92 should be returned since the client should not retry unless 

93 they have first fixed up the directory by deleting files from it. 

94(d) Use FAILED_PRECONDITION if the client performs conditional 

95 REST Get/Update/Delete on a resource and the resource on the 

96 server does not match the condition. E.g., conflicting 

97 read-modify-write on the same resource. 

98""" 

99FAILED_PRECONDITION = 9 

100 

101""" 

102The operation was aborted, typically due to a concurrency issue 

103like sequencer check failures, transaction aborts, etc. 

104 

105See litmus test above for deciding between FAILED_PRECONDITION, 

106ABORTED, and UNAVAILABLE. 

107""" 

108ABORTED = 10 

109 

110""" 

111Operation tried to iterate past the valid input range. E.g., seeking or 

112reading past end of file. 

113 

114Unlike INVALID_ARGUMENT, this error indicates a problem that may 

115be fixed if the system state changes. For example, a 32-bit file 

116system will generate INVALID_ARGUMENT if asked to read at an 

117offset that is not in the range [0,2^32-1], but it will generate 

118OUT_OF_RANGE if asked to read from an offset past the current 

119file size. 

120 

121There is a fair bit of overlap between FAILED_PRECONDITION and 

122OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific 

123error) when it applies so that callers who are iterating through 

124a space can easily look for an OUT_OF_RANGE error to detect when 

125they are done. 

126""" 

127OUT_OF_RANGE = 11 

128 

129# Operation is not implemented or not supported/enabled in this service. 

130UNIMPLEMENTED = 12 

131 

132""" 

133Internal errors. Means some invariant expected by the underlying 

134system has been broken. If you see one of these errors, 

135something is very broken. 

136""" 

137INTERNAL = 13 

138 

139""" 

140The service is currently unavailable. This is a most likely a 

141transient condition and may be corrected by retrying with 

142a backoff. 

143 

144See litmus test above for deciding between FAILED_PRECONDITION, 

145ABORTED, and UNAVAILABLE. 

146""" 

147UNAVAILABLE = 14 

148 

149# Unrecoverable data loss or corruption. 

150DATA_LOSS = 15 

151 

152""" 

153The request does not have valid authentication credentials for the 

154operation. 

155""" 

156UNAUTHENTICATED = 16 

157 

158""" 

159An extra enum entry to prevent people from writing code that 

160fails to compile when a new code is added. 

161 

162Nobody should ever reference this enumeration entry. In particular, 

163if you write C++ code that switches on this enumeration, add a default: 

164case instead of a case that mentions this enumeration entry. 

165 

166Nobody should rely on the value (currently 20) listed here. It 

167may change in the future. 

168""" 

169DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_ = 20