You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2016/12/08 19:19:00 UTC

[1/2] incubator-beam git commit: Handle empty batches in GcsIO batch methods

Repository: incubator-beam
Updated Branches:
  refs/heads/python-sdk 75be6e974 -> 1392f70b6


Handle empty batches in GcsIO batch methods


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

Branch: refs/heads/python-sdk
Commit: 3ef83b3396a4574b3283b29ba1f878b31badd612
Parents: 75be6e9
Author: Charles Chen <cc...@google.com>
Authored: Wed Dec 7 15:03:01 2016 -0800
Committer: Robert Bradshaw <ro...@google.com>
Committed: Thu Dec 8 11:18:51 2016 -0800

----------------------------------------------------------------------
 sdks/python/apache_beam/io/gcsio.py      | 4 ++++
 sdks/python/apache_beam/io/gcsio_test.py | 4 ++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/3ef83b33/sdks/python/apache_beam/io/gcsio.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcsio.py b/sdks/python/apache_beam/io/gcsio.py
index 748465f..f150c4c 100644
--- a/sdks/python/apache_beam/io/gcsio.py
+++ b/sdks/python/apache_beam/io/gcsio.py
@@ -204,6 +204,8 @@ class GcsIO(object):
              argument, where exception is None if the operation succeeded or
              the relevant exception if the operation failed.
     """
+    if not paths:
+      return []
     batch_request = BatchApiRequest(
         retryable_codes=retry.SERVER_ERROR_OR_TIMEOUT_CODES)
     for path in paths:
@@ -264,6 +266,8 @@ class GcsIO(object):
              src_dest_pairs argument, where exception is None if the operation
              succeeded or the relevant exception if the operation failed.
     """
+    if not src_dest_pairs:
+      return []
     batch_request = BatchApiRequest(
         retryable_codes=retry.SERVER_ERROR_OR_TIMEOUT_CODES)
     for src, dest in src_dest_pairs:

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/3ef83b33/sdks/python/apache_beam/io/gcsio_test.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/io/gcsio_test.py b/sdks/python/apache_beam/io/gcsio_test.py
index 5af13c6..bd7eb51 100644
--- a/sdks/python/apache_beam/io/gcsio_test.py
+++ b/sdks/python/apache_beam/io/gcsio_test.py
@@ -265,6 +265,10 @@ class TestGCSIO(unittest.TestCase):
     with self.assertRaises(ValueError):
       self.gcs.open(file_name, 'r+b')
 
+  def test_empty_batches(self):
+    self.assertEqual([], self.gcs.copy_batch([]))
+    self.assertEqual([], self.gcs.delete_batch([]))
+
   def test_delete(self):
     file_name = 'gs://gcsio-test/delete_me'
     file_size = 1024


[2/2] incubator-beam git commit: Closes #1544

Posted by ro...@apache.org.
Closes #1544


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

Branch: refs/heads/python-sdk
Commit: 1392f70b6ee2db76e333fad16efe0cfdd00e7175
Parents: 75be6e9 3ef83b3
Author: Robert Bradshaw <ro...@google.com>
Authored: Thu Dec 8 11:18:52 2016 -0800
Committer: Robert Bradshaw <ro...@google.com>
Committed: Thu Dec 8 11:18:52 2016 -0800

----------------------------------------------------------------------
 sdks/python/apache_beam/io/gcsio.py      | 4 ++++
 sdks/python/apache_beam/io/gcsio_test.py | 4 ++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------