You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by al...@apache.org on 2017/04/10 22:23:32 UTC

[1/2] beam git commit: Skip query metrics when creating a template

Repository: beam
Updated Branches:
  refs/heads/master 1c7a974ab -> 1761d1cab


Skip query metrics when creating a template


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

Branch: refs/heads/master
Commit: 678833096550cf81da0fe026ab978626e395ef11
Parents: 1c7a974
Author: Maria Garcia Herrero <ma...@google.com>
Authored: Sat Apr 8 23:08:44 2017 -0700
Committer: Ahmet Altay <al...@google.com>
Committed: Mon Apr 10 15:23:18 2017 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/examples/wordcount.py       | 16 ++++++++++------
 .../runners/dataflow/internal/apiclient.py          |  2 ++
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/67883309/sdks/python/apache_beam/examples/wordcount.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/examples/wordcount.py b/sdks/python/apache_beam/examples/wordcount.py
index 27b9dcb..a155148 100644
--- a/sdks/python/apache_beam/examples/wordcount.py
+++ b/sdks/python/apache_beam/examples/wordcount.py
@@ -108,12 +108,16 @@ def run(argv=None):
   # Actually run the pipeline (all operations above are deferred).
   result = p.run()
   result.wait_until_finish()
-  empty_lines_filter = MetricsFilter().with_name('empty_lines')
-  query_result = result.metrics().query(empty_lines_filter)
-  if query_result['counters']:
-    empty_lines_counter = query_result['counters'][0]
-    logging.info('number of empty lines: %d', empty_lines_counter.committed)
-  # TODO(pabloem)(BEAM-1366): Add querying of MEAN metrics.
+
+  # Do not query metrics when creating a template which doesn't run
+  if (not hasattr(result, 'has_job')    # direct runner
+      or result.has_job):               # not just a template creation
+    empty_lines_filter = MetricsFilter().with_name('empty_lines')
+    query_result = result.metrics().query(empty_lines_filter)
+    if query_result['counters']:
+      empty_lines_counter = query_result['counters'][0]
+      logging.info('number of empty lines: %d', empty_lines_counter.committed)
+    # TODO(pabloem)(BEAM-1366): Add querying of MEAN metrics.
 
 if __name__ == '__main__':
   logging.getLogger().setLevel(logging.INFO)

http://git-wip-us.apache.org/repos/asf/beam/blob/67883309/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py b/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
index 6d4e538..2b6f3fd 100644
--- a/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
+++ b/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
@@ -438,6 +438,8 @@ class DataflowApplicationClient(object):
     if not template_location:
       return self.submit_job_description(job)
     else:
+      logging.info('A template was just created at location %s',
+                   template_location)
       return None
 
   def create_job_description(self, job):


[2/2] beam git commit: This closes #2475

Posted by al...@apache.org.
This closes #2475


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

Branch: refs/heads/master
Commit: 1761d1cabf47e34fd9107c5673339aa966148f0e
Parents: 1c7a974 6788330
Author: Ahmet Altay <al...@google.com>
Authored: Mon Apr 10 15:23:21 2017 -0700
Committer: Ahmet Altay <al...@google.com>
Committed: Mon Apr 10 15:23:21 2017 -0700

----------------------------------------------------------------------
 sdks/python/apache_beam/examples/wordcount.py       | 16 ++++++++++------
 .../runners/dataflow/internal/apiclient.py          |  2 ++
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------