Skip to content

Commit e7e3cf7

Browse files
committed
update docstring of attempt_direct_path arg
1 parent b223b85 commit e7e3cf7

File tree

2 files changed

+38
-23
lines changed

2 files changed

+38
-23
lines changed

google/api_core/grpc_helpers.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,10 @@ def _create_composite_credentials(
283283
else:
284284
# Use grpc.compute_engine_channel_credentials in order to support Direct Path.
285285
# See https://grpc.github.io/grpc/python/grpc.html#grpc.compute_engine_channel_credentials
286-
# TODO(b/323073050): Although `grpc.compute_engine_channel_credentials`
287-
# returns channel credentials outside of GCE, we should determine if there is a way to
288-
# reliably detect when the client is in a GCE environment so that
286+
# TODO(b/323073050):
287+
# Although `grpc.compute_engine_channel_credentials` returns channel credentials
288+
# outside of a Google Compute Engine environment (GCE), we should determine if
289+
# there is a way to reliably detect a GCE environment so that
289290
# `grpc.compute_engine_channel_credentials` is not called outside of GCE.
290291
return grpc.compute_engine_channel_credentials(google_auth_credentials)
291292

@@ -324,16 +325,23 @@ def create_channel(
324325
default_host (str): The default endpoint. e.g., "pubsub.googleapis.com".
325326
compression (grpc.Compression): An optional value indicating the
326327
compression method to be used over the lifetime of the channel.
327-
attempt_direct_path (Optional[bool]): If set, Direct Path will be attempted when
328-
the request is made. Direct Path provides a proxyless connection which
329-
increases the available throughput, reduces latency, and increases
330-
reliability. Outside of GCE, the direct path request may fallback
331-
to DNS if this is configured by the Service. This argument should only
332-
be set in a GCE environment and for Services that are known to support Direct Path.
333-
If a `ServiceUnavailable` response is received when the request is sent, it is
334-
recommended that the client repeat the request with `attempt_direct_path` set to `False`
335-
as the Service may not support Direct Path. Using `ssl_credentials` with `attempt_direct_path`
336-
set to `True` will result in `ValueError` as it is not yet supported.
328+
attempt_direct_path (Optional[bool]): If set, Direct Path will be attempted
329+
when the request is made. Direct Path is only available within a Google
330+
Compute Engine (GCE) environment and provides a proxyless connection
331+
which increases the available throughput, reduces latency, and increases
332+
reliability. Note:
333+
334+
- This argument should only be set in a GCE environment and for Services
335+
that are known to support Direct Path.
336+
- If this argument is set outside of GCE, then this request will fail
337+
unless the back-end service happens to have configured fall-back to DNS.
338+
- If the request causes a `ServiceUnavailable` response, it is recommended
339+
that the client repeat the request with `attempt_direct_path` set to
340+
`False` as the Service may not support Direct Path.
341+
- Using `ssl_credentials` with `attempt_direct_path`
342+
set to `True` will result in `ValueError` as this combination is not yet
343+
supported.
344+
337345
kwargs: Additional key-word args passed to
338346
:func:`grpc_gcp.secure_channel` or :func:`grpc.secure_channel`.
339347
Note: `grpc_gcp` is only supported in environments with protobuf < 4.0.0.

google/api_core/grpc_helpers_async.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,16 +247,23 @@ def create_channel(
247247
default_host (str): The default endpoint. e.g., "pubsub.googleapis.com".
248248
compression (grpc.Compression): An optional value indicating the
249249
compression method to be used over the lifetime of the channel.
250-
attempt_direct_path (Optional[bool]): If set, Direct Path will be attempted when
251-
the request is made. Direct Path provides a proxyless connection which
252-
increases the available throughput, reduces latency, and increases
253-
reliability. Outside of GCE, the direct path request may fallback
254-
to DNS if this is configured by the Service. This argument should only
255-
be set in a GCE environment and for Services that are known to support Direct Path.
256-
If a `ServiceUnavailable` response is received when the request is sent, it is
257-
recommended that the client repeat the request with `attempt_direct_path` set to `False`
258-
as the Service may not support Direct Path. Using `ssl_credentials` with `attempt_direct_path`
259-
set to `True` will result in `ValueError` as it is not yet supported.
250+
attempt_direct_path (Optional[bool]): If set, Direct Path will be attempted
251+
when the request is made. Direct Path is only available within a Google
252+
Compute Engine (GCE) environment and provides a proxyless connection
253+
which increases the available throughput, reduces latency, and increases
254+
reliability. Note:
255+
256+
- This argument should only be set in a GCE environment and for Services
257+
that are known to support Direct Path.
258+
- If this argument is set outside of GCE, then this request will fail
259+
unless the back-end service happens to have configured fall-back to DNS.
260+
- If the request causes a `ServiceUnavailable` response, it is recommended
261+
that the client repeat the request with `attempt_direct_path` set to
262+
`False` as the Service may not support Direct Path.
263+
- Using `ssl_credentials` with `attempt_direct_path`
264+
set to `True` will result in `ValueError` as this combination is not yet
265+
supported.
266+
260267
kwargs: Additional key-word args passed to :func:`aio.secure_channel`.
261268
262269
Returns:

0 commit comments

Comments
 (0)