beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rober...@apache.org
Subject [3/4] incubator-beam git commit: Replace call() with check_call()
Date Fri, 01 Jul 2016 00:01:59 GMT
Replace call() with check_call()


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

Branch: refs/heads/python-sdk
Commit: 5fe6d7bf4c5cd8bb7b94fc55910a4cb2aee9462a
Parents: 33720ec
Author: Silviu Calinoiu <silviuc@google.com>
Authored: Thu Jun 30 15:49:56 2016 -0700
Committer: Robert Bradshaw <robertwb@google.com>
Committed: Thu Jun 30 17:00:11 2016 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/utils/dependency.py | 27 ++++++------------------
 1 file changed, 6 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/5fe6d7bf/sdks/python/apache_beam/utils/dependency.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/utils/dependency.py b/sdks/python/apache_beam/utils/dependency.py
index c52a5b7..7d9bd10 100644
--- a/sdks/python/apache_beam/utils/dependency.py
+++ b/sdks/python/apache_beam/utils/dependency.py
@@ -81,10 +81,7 @@ def _dependency_file_copy(from_path, to_path):
   if from_path.startswith('gs://') or to_path.startswith('gs://'):
     command_args = ['gsutil', '-m', '-q', 'cp', from_path, to_path]
     logging.info('Executing command: %s', command_args)
-    result = processes.call(command_args)
-    if result != 0:
-      raise ValueError(
-          'Failed to copy GCS file from %s to %s.' % (from_path, to_path))
+    processes.check_call(command_args)
   else:
     # Branch used only for unit tests and integration tests.
     # In such environments GCS support is not available.
@@ -199,11 +196,7 @@ def _populate_requirements_cache(requirements_file, cache_dir):
       # Download from PyPI source distributions.
       '--no-binary', ':all:']
   logging.info('Executing command: %s', cmd_args)
-  result = processes.call(cmd_args)
-  if result != 0:
-    raise RuntimeError(
-        'Failed to execute command: %s. Exit code %d',
-        cmd_args, result)
+  processes.check_call(cmd_args)
 
 
 def stage_job_resources(
@@ -381,11 +374,7 @@ def _build_setup_package(setup_file, temp_dir, build_setup_args=None):
           'python', os.path.basename(setup_file),
           'sdist', '--dist-dir', temp_dir]
     logging.info('Executing command: %s', build_setup_args)
-    result = processes.call(build_setup_args)
-    if result != 0:
-      raise RuntimeError(
-          'Failed to execute command: %s. Exit code %d',
-          build_setup_args, result)
+    processes.check_call(build_setup_args)
     output_files = glob.glob(os.path.join(temp_dir, '*.tar.gz'))
     if not output_files:
       raise RuntimeError(
@@ -438,8 +427,8 @@ def get_required_container_version():
   import pkg_resources as pkg
   try:
     version = pkg.get_distribution(GOOGLE_PACKAGE_NAME).version
-    # We drop any pre/post parts of the version and we keep only the X.Y.Z format.
-    # For instance the 0.3.0rc2 SDK version translates into 0.3.0.
+    # We drop any pre/post parts of the version and we keep only the X.Y.Z
+    # format.  For instance the 0.3.0rc2 SDK version translates into 0.3.0.
     return '%s.%s.%s' % pkg.parse_version(version)._version.release
   except pkg.DistributionNotFound:
     # This case covers Apache Beam end-to-end testing scenarios. All these tests
@@ -458,11 +447,7 @@ def _download_pypi_sdk_package(temp_dir):
       '%s==%s' % (GOOGLE_PACKAGE_NAME, version),
       '--no-binary', ':all:', '--no-deps']
   logging.info('Executing command: %s', cmd_args)
-  result = processes.call(cmd_args)
-  if result != 0:
-    raise RuntimeError(
-        'Failed to execute command: %s. Exit code %d',
-        cmd_args, result)
+  processes.check_call(cmd_args)
   zip_expected = os.path.join(
       temp_dir, '%s-%s.zip' % (GOOGLE_PACKAGE_NAME, version))
   if os.path.exists(zip_expected):


Mime
View raw message