beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boyu...@apache.org
Subject [beam] branch master updated: Guard grpc import.
Date Fri, 01 May 2020 16:26:22 GMT
This is an automated email from the ASF dual-hosted git repository.

boyuanz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new c7be705  Guard grpc import.
     new b78c7ed  Merge pull request #11587 from robertwb/no-grpc
c7be705 is described below

commit c7be7052ad11ff38c8bafab08614762404e2561e
Author: Robert Bradshaw <robertwb@gmail.com>
AuthorDate: Thu Apr 30 22:47:14 2020 -0700

    Guard grpc import.
---
 sdks/python/apache_beam/utils/subprocess_server.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sdks/python/apache_beam/utils/subprocess_server.py b/sdks/python/apache_beam/utils/subprocess_server.py
index 6d18769..92b60b5 100644
--- a/sdks/python/apache_beam/utils/subprocess_server.py
+++ b/sdks/python/apache_beam/utils/subprocess_server.py
@@ -31,12 +31,19 @@ import tempfile
 import threading
 import time
 
-import grpc
 from future.moves.urllib.error import URLError
 from future.moves.urllib.request import urlopen
 
 from apache_beam.version import __version__ as beam_version
 
+# Protect against environments where grpc is not available.
+# pylint: disable=wrong-import-order, wrong-import-position, ungrouped-imports
+try:
+  import grpc
+except ImportError:
+  grpc = None
+# pylint: enable=wrong-import-order, wrong-import-position, ungrouped-imports
+
 _LOGGER = logging.getLogger(__name__)
 
 


Mime
View raw message