beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rober...@apache.org
Subject [1/3] incubator-beam git commit: Fix SDK name and version sent to the Cloud Dataflow service
Date Tue, 26 Jul 2016 04:11:41 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/python-sdk 153916fe9 -> 26ff65795


Fix SDK name and version sent to the Cloud Dataflow service


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

Branch: refs/heads/python-sdk
Commit: 8a7bc71dee1e3f9f17c29e5e558870a6bc5f4880
Parents: 38d9dea
Author: Charles Chen <ccy@google.com>
Authored: Mon Jul 25 18:22:08 2016 -0700
Committer: Charles Chen <ccy@google.com>
Committed: Mon Jul 25 18:22:08 2016 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/internal/apiclient.py |  6 +++---
 sdks/python/apache_beam/utils/dependency.py   | 11 +++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8a7bc71d/sdks/python/apache_beam/internal/apiclient.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/internal/apiclient.py b/sdks/python/apache_beam/internal/apiclient.py
index 363b8e1..137a40b 100644
--- a/sdks/python/apache_beam/internal/apiclient.py
+++ b/sdks/python/apache_beam/internal/apiclient.py
@@ -29,7 +29,6 @@ from apitools.base.py import encoding
 from apitools.base.py import exceptions
 
 from apache_beam import utils
-from apache_beam import version
 from apache_beam.internal import pickler
 from apache_beam.internal.auth import get_service_credentials
 from apache_beam.internal.json_value import to_json_value
@@ -39,6 +38,7 @@ from apache_beam.utils import dependency
 from apache_beam.utils import names
 from apache_beam.utils import retry
 from apache_beam.utils.dependency import get_required_container_version
+from apache_beam.utils.dependency import get_sdk_name_and_version
 from apache_beam.utils.names import PropertyNames
 from apache_beam.utils.options import GoogleCloudOptions
 from apache_beam.utils.options import StandardOptions
@@ -191,12 +191,12 @@ class Environment(object):
     self.proto.userAgent = dataflow.Environment.UserAgentValue()
     self.local = 'localhost' in self.google_cloud_options.dataflow_endpoint
 
-    version_string = version.__version__
+    sdk_name, version_string = get_sdk_name_and_version()
 
     self.proto.userAgent.additionalProperties.extend([
         dataflow.Environment.UserAgentValue.AdditionalProperty(
             key='name',
-            value=to_json_value('Google Cloud Dataflow SDK for Python')),
+            value=to_json_value(sdk_name)),
         dataflow.Environment.UserAgentValue.AdditionalProperty(
             key='version', value=to_json_value(version_string))])
     # Version information.

http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/8a7bc71d/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 b809cf2..d8e0036 100644
--- a/sdks/python/apache_beam/utils/dependency.py
+++ b/sdks/python/apache_beam/utils/dependency.py
@@ -59,6 +59,7 @@ import tempfile
 
 
 from apache_beam import utils
+from apache_beam import version as beam_version
 from apache_beam.internal import pickler
 from apache_beam.utils import names
 from apache_beam.utils import processes
@@ -437,6 +438,16 @@ def get_required_container_version():
     return 'beamhead'
 
 
+def get_sdk_name_and_version():
+  """Returns the name and version of the SDK reported to Cloud Dataflow."""
+  # TODO(ccy): Make this check cleaner.
+  container_version = get_required_container_version()
+  if container_version == 'beamhead':
+    return ('Apache Beam SDK for Python', beam_version.__version__)
+  else:
+    return ('Google Cloud Dataflow SDK for Python', container_version)
+
+
 def _download_pypi_sdk_package(temp_dir):
   """Downloads SDK package from PyPI and returns path to local path."""
   # TODO(silviuc): Handle apache-beam versions when we have official releases.


Mime
View raw message