Skip to content

Commit 15f2c36

Browse files
dpebottseaver
authored andcommitted
Fix client_info bug, update docstrings and timeouts. (#6422)
1 parent 3964ad2 commit 15f2c36

File tree

8 files changed

+684
-792
lines changed

8 files changed

+684
-792
lines changed

tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client.py

Lines changed: 240 additions & 276 deletions
Large diffs are not rendered by default.

tasks/google/cloud/tasks_v2beta2/gapic/cloud_tasks_client_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"methods": {
2020
"ListQueues": {
21-
"timeout_millis": 10000,
21+
"timeout_millis": 15000,
2222
"retry_codes_name": "idempotent",
2323
"retry_params_name": "default"
2424
},

tasks/google/cloud/tasks_v2beta2/gapic/enums.py

Lines changed: 80 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ class Code(enum.IntEnum):
4242
"""
4343
The canonical error codes for Google APIs.
4444
45-
46-
Sometimes multiple error codes may apply. Services should return
47-
the most specific error code that applies. For example, prefer
45+
Sometimes multiple error codes may apply. Services should return the
46+
most specific error code that applies. For example, prefer
4847
``OUT_OF_RANGE`` over ``FAILED_PRECONDITION`` if both codes apply.
49-
Similarly prefer ``NOT_FOUND`` or ``ALREADY_EXISTS`` over ``FAILED_PRECONDITION``.
48+
Similarly prefer ``NOT_FOUND`` or ``ALREADY_EXISTS`` over
49+
``FAILED_PRECONDITION``.
5050
5151
Attributes:
5252
OK (int): Not an error; returned on success
@@ -55,17 +55,16 @@ class Code(enum.IntEnum):
5555
CANCELLED (int): The operation was cancelled, typically by the caller.
5656
5757
HTTP Mapping: 499 Client Closed Request
58-
UNKNOWN (int): Unknown error. For example, this error may be returned when
59-
a ``Status`` value received from another address space belongs to
60-
an error space that is not known in this address space. Also
61-
errors raised by APIs that do not return enough error information
62-
may be converted to this error.
58+
UNKNOWN (int): Unknown error. For example, this error may be returned when a ``Status``
59+
value received from another address space belongs to an error space that
60+
is not known in this address space. Also errors raised by APIs that do
61+
not return enough error information may be converted to this error.
6362
6463
HTTP Mapping: 500 Internal Server Error
65-
INVALID_ARGUMENT (int): The client specified an invalid argument. Note that this differs
66-
from ``FAILED_PRECONDITION``. ``INVALID_ARGUMENT`` indicates arguments
67-
that are problematic regardless of the state of the system
68-
(e.g., a malformed file name).
64+
INVALID_ARGUMENT (int): The client specified an invalid argument. Note that this differs from
65+
``FAILED_PRECONDITION``. ``INVALID_ARGUMENT`` indicates arguments that
66+
are problematic regardless of the state of the system (e.g., a malformed
67+
file name).
6968
7069
HTTP Mapping: 400 Bad Request
7170
DEADLINE_EXCEEDED (int): The deadline expired before the operation could complete. For operations
@@ -77,25 +76,24 @@ class Code(enum.IntEnum):
7776
HTTP Mapping: 504 Gateway Timeout
7877
NOT_FOUND (int): Some requested entity (e.g., file or directory) was not found.
7978
80-
Note to server developers: if a request is denied for an entire class
81-
of users, such as gradual feature rollout or undocumented whitelist,
79+
Note to server developers: if a request is denied for an entire class of
80+
users, such as gradual feature rollout or undocumented whitelist,
8281
``NOT_FOUND`` may be used. If a request is denied for some users within
83-
a class of users, such as user-based access control, ``PERMISSION_DENIED``
84-
must be used.
82+
a class of users, such as user-based access control,
83+
``PERMISSION_DENIED`` must be used.
8584
8685
HTTP Mapping: 404 Not Found
8786
ALREADY_EXISTS (int): The entity that a client attempted to create (e.g., file or directory)
8887
already exists.
8988
9089
HTTP Mapping: 409 Conflict
91-
PERMISSION_DENIED (int): The caller does not have permission to execute the specified
92-
operation. ``PERMISSION_DENIED`` must not be used for rejections
93-
caused by exhausting some resource (use ``RESOURCE_EXHAUSTED``
94-
instead for those errors). ``PERMISSION_DENIED`` must not be
95-
used if the caller can not be identified (use ``UNAUTHENTICATED``
96-
instead for those errors). This error code does not imply the
97-
request is valid or the requested entity exists or satisfies
98-
other pre-conditions.
90+
PERMISSION_DENIED (int): The caller does not have permission to execute the specified operation.
91+
``PERMISSION_DENIED`` must not be used for rejections caused by
92+
exhausting some resource (use ``RESOURCE_EXHAUSTED`` instead for those
93+
errors). ``PERMISSION_DENIED`` must not be used if the caller can not be
94+
identified (use ``UNAUTHENTICATED`` instead for those errors). This
95+
error code does not imply the request is valid or the requested entity
96+
exists or satisfies other pre-conditions.
9997
10098
HTTP Mapping: 403 Forbidden
10199
UNAUTHENTICATED (int): The request does not have valid authentication credentials for the
@@ -106,26 +104,20 @@ class Code(enum.IntEnum):
106104
perhaps the entire file system is out of space.
107105
108106
HTTP Mapping: 429 Too Many Requests
109-
FAILED_PRECONDITION (int): The operation was rejected because the system is not in a state
110-
required for the operation's execution. For example, the directory
111-
to be deleted is non-empty, an rmdir operation is applied to
112-
a non-directory, etc.
113-
114-
Service implementors can use the following guidelines to decide
115-
between ``FAILED_PRECONDITION``, ``ABORTED``, and ``UNAVAILABLE``:
116-
(a) Use ``UNAVAILABLE`` if the client can retry just the failing call.
117-
(b) Use ``ABORTED`` if the client should retry at a higher level
118-
::
119-
120-
(e.g., when a client-specified test-and-set fails, indicating the
121-
client should restart a read-modify-write sequence).
122-
(c) Use ``FAILED_PRECONDITION`` if the client should not retry until
123-
::
124-
125-
the system state has been explicitly fixed. E.g., if an \"rmdir\"
126-
fails because the directory is non-empty, `FAILED_PRECONDITION`
127-
should be returned since the client should not retry unless
128-
the files are deleted from the directory.
107+
FAILED_PRECONDITION (int): The operation was rejected because the system is not in a state required
108+
for the operation's execution. For example, the directory to be deleted
109+
is non-empty, an rmdir operation is applied to a non-directory, etc.
110+
111+
Service implementors can use the following guidelines to decide between
112+
``FAILED_PRECONDITION``, ``ABORTED``, and ``UNAVAILABLE``: (a) Use
113+
``UNAVAILABLE`` if the client can retry just the failing call. (b) Use
114+
``ABORTED`` if the client should retry at a higher level (e.g., when a
115+
client-specified test-and-set fails, indicating the client should
116+
restart a read-modify-write sequence). (c) Use ``FAILED_PRECONDITION``
117+
if the client should not retry until the system state has been
118+
explicitly fixed. E.g., if an "rmdir" fails because the directory is
119+
non-empty, ``FAILED_PRECONDITION`` should be returned since the client
120+
should not retry unless the files are deleted from the directory.
129121
130122
HTTP Mapping: 400 Bad Request
131123
ABORTED (int): The operation was aborted, typically due to a concurrency issue such as
@@ -135,21 +127,20 @@ class Code(enum.IntEnum):
135127
``ABORTED``, and ``UNAVAILABLE``.
136128
137129
HTTP Mapping: 409 Conflict
138-
OUT_OF_RANGE (int): The operation was attempted past the valid range. E.g., seeking or
130+
OUT_OF_RANGE (int): The operation was attempted past the valid range. E.g., seeking or
139131
reading past end-of-file.
140132
141-
Unlike ``INVALID_ARGUMENT``, this error indicates a problem that may
142-
be fixed if the system state changes. For example, a 32-bit file
143-
system will generate ``INVALID_ARGUMENT`` if asked to read at an
144-
offset that is not in the range [0,2^32-1], but it will generate
145-
``OUT_OF_RANGE`` if asked to read from an offset past the current
146-
file size.
133+
Unlike ``INVALID_ARGUMENT``, this error indicates a problem that may be
134+
fixed if the system state changes. For example, a 32-bit file system
135+
will generate ``INVALID_ARGUMENT`` if asked to read at an offset that is
136+
not in the range [0,2^32-1], but it will generate ``OUT_OF_RANGE`` if
137+
asked to read from an offset past the current file size.
147138
148139
There is a fair bit of overlap between ``FAILED_PRECONDITION`` and
149-
``OUT_OF_RANGE``. We recommend using ``OUT_OF_RANGE`` (the more specific
150-
error) when it applies so that callers who are iterating through
151-
a space can easily look for an ``OUT_OF_RANGE`` error to detect when
152-
they are done.
140+
``OUT_OF_RANGE``. We recommend using ``OUT_OF_RANGE`` (the more specific
141+
error) when it applies so that callers who are iterating through a space
142+
can easily look for an ``OUT_OF_RANGE`` error to detect when they are
143+
done.
153144
154145
HTTP Mapping: 400 Bad Request
155146
UNIMPLEMENTED (int): The operation is not implemented or is not supported/enabled in this
@@ -161,9 +152,8 @@ class Code(enum.IntEnum):
161152
for serious errors.
162153
163154
HTTP Mapping: 500 Internal Server Error
164-
UNAVAILABLE (int): The service is currently unavailable. This is most likely a
165-
transient condition, which can be corrected by retrying with
166-
a backoff.
155+
UNAVAILABLE (int): The service is currently unavailable. This is most likely a transient
156+
condition, which can be corrected by retrying with a backoff.
167157
168158
See the guidelines above for deciding between ``FAILED_PRECONDITION``,
169159
``ABORTED``, and ``UNAVAILABLE``.
@@ -201,27 +191,26 @@ class State(enum.IntEnum):
201191
STATE_UNSPECIFIED (int): Unspecified state.
202192
RUNNING (int): The queue is running. Tasks can be dispatched.
203193
204-
If the queue was created using Cloud Tasks and the queue has
205-
had no activity (method calls or task dispatches) for 30 days,
206-
the queue may take a few minutes to re-activate. Some method
207-
calls may return ``NOT_FOUND`` and
208-
tasks may not be dispatched for a few minutes until the queue
209-
has been re-activated.
210-
PAUSED (int): Tasks are paused by the user. If the queue is paused then Cloud
211-
Tasks will stop delivering tasks from it, but more tasks can
212-
still be added to it by the user. When a pull queue is paused,
213-
all ``LeaseTasks`` calls will return a
214-
``FAILED_PRECONDITION``.
194+
If the queue was created using Cloud Tasks and the queue has had no
195+
activity (method calls or task dispatches) for 30 days, the queue may
196+
take a few minutes to re-activate. Some method calls may return
197+
``NOT_FOUND`` and tasks may not be dispatched for a few minutes until
198+
the queue has been re-activated.
199+
PAUSED (int): Tasks are paused by the user. If the queue is paused then Cloud Tasks
200+
will stop delivering tasks from it, but more tasks can still be added to
201+
it by the user. When a pull queue is paused, all ``LeaseTasks`` calls
202+
will return a ``FAILED_PRECONDITION``.
215203
DISABLED (int): The queue is disabled.
216204
217205
A queue becomes ``DISABLED`` when
218-
`queue.yaml <https://cloud.google.com/appengine/docs/python/config/queueref>`_ or
219-
`queue.xml <https://cloud.google.com/appengine/docs/standard/java/config/queueref>`_ is uploaded
220-
which does not contain the queue. You cannot directly disable a queue.
221-
222-
When a queue is disabled, tasks can still be added to a queue
223-
but the tasks are not dispatched and
224-
``LeaseTasks`` calls return a
206+
`queue.yaml <https://cloud.google.com/appengine/docs/python/config/queueref>`__
207+
or
208+
`queue.xml <https://cloud.google.com/appengine/docs/standard/java/config/queueref>`__
209+
is uploaded which does not contain the queue. You cannot directly
210+
disable a queue.
211+
212+
When a queue is disabled, tasks can still be added to a queue but the
213+
tasks are not dispatched and ``LeaseTasks`` calls return a
225214
``FAILED_PRECONDITION`` error.
226215
227216
To permanently delete this queue and all of its tasks, call
@@ -238,28 +227,25 @@ class View(enum.IntEnum):
238227
"""
239228
The view specifies a subset of ``Task`` data.
240229
241-
When a task is returned in a response, not all
242-
information is retrieved by default because some data, such as
243-
payloads, might be desirable to return only when needed because
244-
of its large size or because of the sensitivity of data that it
245-
contains.
230+
When a task is returned in a response, not all information is retrieved
231+
by default because some data, such as payloads, might be desirable to
232+
return only when needed because of its large size or because of the
233+
sensitivity of data that it contains.
246234
247235
Attributes:
248236
VIEW_UNSPECIFIED (int): Unspecified. Defaults to BASIC.
249-
BASIC (int): The basic view omits fields which can be large or can contain
250-
sensitive data.
251-
252-
This view does not include the
253-
(``payload in AppEngineHttpRequest`` and
254-
``payload in PullMessage``). These payloads are
255-
desirable to return only when needed, because they can be large
256-
and because of the sensitivity of the data that you choose to
257-
store in it.
237+
BASIC (int): The basic view omits fields which can be large or can contain sensitive
238+
data.
239+
240+
This view does not include the (``payload in AppEngineHttpRequest`` and
241+
``payload in PullMessage``). These payloads are desirable to return only
242+
when needed, because they can be large and because of the sensitivity of
243+
the data that you choose to store in it.
258244
FULL (int): All information is returned.
259245
260-
Authorization for ``FULL`` requires
261-
``cloudtasks.tasks.fullView`` `Google IAM <https://cloud.google.com/iam/>`_
262-
permission on the ``Queue`` resource.
246+
Authorization for ``FULL`` requires ``cloudtasks.tasks.fullView``
247+
`Google IAM <https://cloud.google.com/iam/>`__ permission on the
248+
``Queue`` resource.
263249
"""
264250
VIEW_UNSPECIFIED = 0
265251
BASIC = 1

0 commit comments

Comments
 (0)