From 46b21c9213b42419ba7727ae4818b0df4b031e86 Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Wed, 10 Aug 2016 15:48:38 -0400 Subject: [PATCH 1/2] Re-enable GAX by default if it is importable. As of the '0.8.1' versions of the wrappers, the pubsub and logging system tests pass on Python3.4 with GAX enabled. --- gcloud/logging/client.py | 3 ++- gcloud/pubsub/client.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gcloud/logging/client.py b/gcloud/logging/client.py index 9bee2668849e..c51f502ac075 100644 --- a/gcloud/logging/client.py +++ b/gcloud/logging/client.py @@ -47,7 +47,8 @@ from gcloud.logging.sink import Sink -_USE_GAX = _HAVE_GAX and (os.environ.get('GCLOUD_ENABLE_GAX') is not None) +_DISABLE_GAX = os.getenv('GCLOUD_DISABLE_GAX', False) +_USE_GAX = _HAVE_GAX and not _DISABLE_GAX class Client(JSONClient): diff --git a/gcloud/pubsub/client.py b/gcloud/pubsub/client.py index e5f88ab36cb5..eb6e808872f0 100644 --- a/gcloud/pubsub/client.py +++ b/gcloud/pubsub/client.py @@ -41,7 +41,8 @@ # pylint: enable=ungrouped-imports -_USE_GAX = _HAVE_GAX and (os.environ.get('GCLOUD_ENABLE_GAX') is not None) +_DISABLE_GAX = os.getenv('GCLOUD_DISABLE_GAX', False) +_USE_GAX = _HAVE_GAX and not _DISABLE_GAX class Client(JSONClient): From 9cf5b721c7b390b21ac4ae7a13bfbfaa9ef40dcf Mon Sep 17 00:00:00 2001 From: Tres Seaver Date: Wed, 10 Aug 2016 17:07:55 -0400 Subject: [PATCH 2/2] Document disabling the on-by-default gRPC/GAX transport for pubsub/logging. Addresses: https://github.com/GoogleCloudPlatform/gcloud-python/pull/2085#issuecomment-238983397 --- docs/logging-usage.rst | 6 ++++++ docs/pubsub-usage.rst | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/docs/logging-usage.rst b/docs/logging-usage.rst index 3dd2a6efab19..e39027c5406f 100644 --- a/docs/logging-usage.rst +++ b/docs/logging-usage.rst @@ -13,6 +13,12 @@ Authentication and Configuration to interact with. If you are Google App Engine or Google Compute Engine this will be detected automatically. +- The library now enables the ``gRPC`` transport for the logging API by + default, assuming that the required dependencies are installed and + importable. To *disable* this transport, set the + :envvar:`GCLOUD_DISABLE_GAX` environment variable to a non-empty string, + e.g.: ``$ export GCLOUD_DISABLE_GAX=1``. + - After configuring your environment, create a :class:`Client ` diff --git a/docs/pubsub-usage.rst b/docs/pubsub-usage.rst index 9a7f7e7acf27..b530fc37672d 100644 --- a/docs/pubsub-usage.rst +++ b/docs/pubsub-usage.rst @@ -7,6 +7,17 @@ Authentication / Configuration - Use :class:`Client ` objects to configure your applications. +- In addition to any authentication configuration, you should also set the + :envvar:`GCLOUD_PROJECT` environment variable for the project you'd like + to interact with. If you are Google App Engine or Google Compute Engine + this will be detected automatically. + +- The library now enables the ``gRPC`` transport for the pubsub API by + default, assuming that the required dependencies are installed and + importable. To *disable* this transport, set the + :envvar:`GCLOUD_DISABLE_GAX` environment variable to a non-empty string, + e.g.: ``$ export GCLOUD_DISABLE_GAX=1``. + - :class:`Client ` objects hold both a ``project`` and an authenticated connection to the PubSub service.