[ 
https://issues.apache.org/jira/browse/BEAM-8258?focusedWorklogId=474911&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-474911
 ]

ASF GitHub Bot logged work on BEAM-8258:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Aug/20 17:29
            Start Date: 26/Aug/20 17:29
    Worklog Time Spent: 10m 
      Work Description: leiyiz commented on a change in pull request #12674:
URL: https://github.com/apache/beam/pull/12674#discussion_r477468609



##########
File path: sdks/python/apache_beam/testing/benchmarks/nexmark/monitor.py
##########
@@ -0,0 +1,59 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import absolute_import
+
+from time import time
+
+import apache_beam as beam
+from apache_beam.metrics import Metrics
+
+
+class Monitor(object):
+  """
+  A monitor of elements with support for later retrieving their metrics
+
+  monitor objects contains a doFn to record metrics
+
+  Args:
+    namespace: the namespace all metrics within this Monitor uses
+    name_prefix: a prefix for this Monitor's metrics' names, intended to
+      be unique in per-monitor basis in pipeline
+  """
+  def __init__(self, namespace, name_prefix):
+    # type: (str, str) -> None
+    self.namespace = namespace
+    self.name_prefix = name_prefix
+    self.doFn = MonitorDoFn(namespace, name_prefix)
+
+
+class MonitorDoFn(beam.DoFn):
+  def __init__(self, namespace, prefix):
+    self.element_count = Metrics.counter(
+        namespace, prefix + MonitorSuffix.ELEMENT_COUNTER)
+    self.event_time = Metrics.distribution(
+        namespace, prefix + MonitorSuffix.EVENT_TIME)
+
+  def process(self, element):
+    self.element_count.inc()
+    self.event_time.update(int(time() * 1000))
+    yield element

Review comment:
       sounds very good




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 474911)
    Time Spent: 4h 50m  (was: 4h 40m)

> Implement Nexmark (benchmark suite) in Python and integrate it with Spark and 
> Flink runners
> -------------------------------------------------------------------------------------------
>
>                 Key: BEAM-8258
>                 URL: https://issues.apache.org/jira/browse/BEAM-8258
>             Project: Beam
>          Issue Type: Bug
>          Components: testing-nexmark
>            Reporter: Ismaël Mejía
>            Priority: P3
>              Labels: gsoc, gsoc2020, mentor
>          Time Spent: 4h 50m
>  Remaining Estimate: 0h
>
> Apache Beam [1] is a unified and portable programming model for data 
> processing jobs (pipelines). The Beam model [2, 3, 4] has rich mechanisms to 
> process endless streams of events.
> Nexmark [5] is a benchmark for streaming jobs, basically a set of jobs 
> (queries) to test different use cases of the execution system. Beam 
> implemented Nexmark for Java [6, 7] and it has been succesfully used to 
> improve the features of multiple Beam runners and discover performance 
> regressions.
> Thanks to the work on portability [8] we can now run Beam pipelines on top of 
> open source systems like Apache Spark [9] and Apache Flink [10]. The goal of 
> this issue/project is to implement the Nexmark queries on Python and 
> configure them to run on our CI on top of open source systems like Apache 
> Spark and Apache Flink. The goal is that it helps the project to track and 
> improve the evolution of portable open source runners and our python 
> implementation as we do for Java.
> Because of the time constraints of GSoC we will adjust the goals (sub-tasks) 
> depending on progress.
> [1] https://beam.apache.org/
> [2] https://www.oreilly.com/ideas/the-world-beyond-batch-streaming-101
> [3] https://www.oreilly.com/ideas/the-world-beyond-batch-streaming-102
> [4] 
> https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/43864.pdf
> [5] 
> https://web.archive.org/web/20100620010601/http://datalab.cs.pdx.edu/niagaraST/NEXMark/
> [6] https://beam.apache.org/documentation/sdks/java/testing/nexmark/
> [7] https://github.com/apache/beam/tree/master/sdks/java/testing/nexmark
> [8] https://beam.apache.org/roadmap/portability/
> [9] https://spark.apache.org/
> [10] https://flink.apache.org/



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to