beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From al...@apache.org
Subject [1/2] beam git commit: Better error on missing gcp dependencies.
Date Mon, 13 Mar 2017 21:14:07 GMT
Repository: beam
Updated Branches:
  refs/heads/master 367d66cbd -> de40c14ff


Better error on missing gcp dependencies.


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/454bbaac
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/454bbaac
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/454bbaac

Branch: refs/heads/master
Commit: 454bbaac4513f531a595af2ae2c73e338b6f6722
Parents: 367d66c
Author: Robert Bradshaw <robertwb@google.com>
Authored: Mon Mar 13 11:18:50 2017 -0700
Committer: Ahmet Altay <altay@google.com>
Committed: Mon Mar 13 14:12:48 2017 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/io/fileio.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/454bbaac/sdks/python/apache_beam/io/fileio.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/fileio.py b/sdks/python/apache_beam/io/fileio.py
index 8b39493..49a2082 100644
--- a/sdks/python/apache_beam/io/fileio.py
+++ b/sdks/python/apache_beam/io/fileio.py
@@ -41,7 +41,12 @@ try:
   DEFAULT_READ_BUFFER_SIZE = gcsio.DEFAULT_READ_BUFFER_SIZE
   MAX_BATCH_OPERATION_SIZE = gcsio.MAX_BATCH_OPERATION_SIZE
 except ImportError:
-  gcsio = None
+  class FakeGcsIO(object):
+    def __getattr__(self, attr):
+      raise ImportError(
+          'Google Cloud Platform IO not available, '
+          'please install apache_beam[gcp]')
+  gcsio = FakeGcsIO()
   DEFAULT_READ_BUFFER_SIZE = 16 * 1024 * 1024
   MAX_BATCH_OPERATION_SIZE = 100
 # pylint: enable=wrong-import-order, wrong-import-position


Mime
View raw message