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

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

                Author: ASF GitHub Bot
            Created on: 25/Jun/19 09:58
            Start Date: 25/Jun/19 09:58
    Worklog Time Spent: 10m 
      Work Description: kkucharc commented on pull request #8847: [BEAM-7550] 
Missing pipeline parameters in ParDo Load Test
URL: https://github.com/apache/beam/pull/8847#discussion_r297105000
 
 

 ##########
 File path: sdks/python/apache_beam/testing/load_tests/pardo_test.py
 ##########
 @@ -132,22 +137,38 @@
 @unittest.skipIf(not load_test_enabled, 'Enabled only for phrase triggering.')
 class ParDoTest(LoadTest):
   def setUp(self):
-    self.output = self.pipeline.get_option('output')
-    self.iterations = self.pipeline.get_option('number_of_counter_operations')
+    super(ParDoTest, self).setUp()
+    self._apply_filter()
+    self.iterations = self._get_option_or_default('iterations')
+    self.nb_of_counter = self._get_option_or_default('number_of_counters')
+    self.nb_of_operations = self._get_option_or_default(
+        'number_of_counter_operations')
+
+  def _apply_filter(self):
+    """Prevents metrics from namespace other than specified in pipeline
+    options from being published."""
+    if self.metrics_monitor is not None:
+      self.metrics_monitor.filters = MetricsFilter().with_namespace(
+          self.metrics_namespace)
+
+  def _get_option_or_default(self, opt_name, default=1):
+    option = self.pipeline.get_option(opt_name)
+    return int(option) if option is not None else default
 
   def testParDo(self):
-    class _GetElement(beam.DoFn):
-      from apache_beam.testing.load_tests.load_test_metrics_utils import 
count_bytes
-
-      @count_bytes
-      def process(self, element, namespace, is_returning):
-        if is_returning:
-          yield element
-
-    if not self.iterations:
-      num_runs = 1
-    else:
-      num_runs = int(self.iterations)
+    class CounterOperation(beam.DoFn):
 
 Review comment:
   I think it would be good to have CountBytes metrics in 
`load_test_metrics_utils`. WDYT about making this class parametrised also by 
name and namespace so it can be reused in future?
 
----------------------------------------------------------------
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: 266505)
    Time Spent: 50m  (was: 40m)

> Implement missing pipeline parameters in ParDo Load Test
> --------------------------------------------------------
>
>                 Key: BEAM-7550
>                 URL: https://issues.apache.org/jira/browse/BEAM-7550
>             Project: Beam
>          Issue Type: Sub-task
>          Components: testing
>            Reporter: Kamil Wasilewski
>            Assignee: Kamil Wasilewski
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Without some pipeline parameters in ParDo Load Test in Python, it is 
> impossible to create all required test cases (see proposal: 
> [https://s.apache.org/load-test-basic-operations]).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to