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

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

                Author: ASF GitHub Bot
            Created on: 19/Mar/19 16:34
            Start Date: 19/Mar/19 16:34
    Worklog Time Spent: 10m 
      Work Description: kkucharc commented on pull request #7965: [BEAM-6175] 
Extract reader and publisher from MetricsMonitor in Python load tests
URL: https://github.com/apache/beam/pull/7965#discussion_r266984013
 
 

 ##########
 File path: sdks/python/apache_beam/testing/load_tests/load_test.py
 ##########
 @@ -0,0 +1,83 @@
+#
+# 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
+
+import json
+import logging
+import os
+import unittest
+
+from apache_beam.testing.load_tests.load_test_metrics_utils import 
MetricsReader
+from apache_beam.testing.test_pipeline import TestPipeline
+
+load_test_enabled = False
+if os.environ.get('LOAD_TEST_ENABLED') == 'true':
+  load_test_enabled = True
+
+
+class LoadTest(unittest.TestCase):
+  def parseTestPipelineOptions(self, options=None):
+    if not options:
+      options = self.input_options
+
+    return {
+        'numRecords': options.get('num_records'),
+        'keySizeBytes': options.get('key_size'),
+        'valueSizeBytes': options.get('value_size'),
+        'bundleSizeDistribution': {
+            'type': options.get(
+                'bundle_size_distribution_type', 'const'
+            ),
+            'param': options.get('bundle_size_distribution_param', 0)
+        },
+        'forceNumInitialBundles': options.get(
+            'force_initial_num_bundles', 0
+        )
+    }
+
+  @classmethod
+  @unittest.skipIf(not load_test_enabled, 'Enabled only for phrase 
triggering.')
+  def setUpClass(cls):
 
 Review comment:
   You are right. I forgot about the case where more tests may appear. This 
solution makes it even more simple, because setUpClass was forcing to add here 
also the skip.
 
----------------------------------------------------------------
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: 215563)
    Time Spent: 4h 10m  (was: 4h)

> Extract reader and publisher from MetricsMonitor in Python Load Test utils
> --------------------------------------------------------------------------
>
>                 Key: BEAM-6175
>                 URL: https://issues.apache.org/jira/browse/BEAM-6175
>             Project: Beam
>          Issue Type: Improvement
>          Components: testing
>            Reporter: Kasia Kucharczyk
>            Assignee: Kasia Kucharczyk
>            Priority: Minor
>              Labels: triaged
>          Time Spent: 4h 10m
>  Remaining Estimate: 0h
>
> For load tests metrics (load_test_utils.py) flexibility purposes, two classes 
> should be extracted from MetricsMonitor class:
> * MetricsReader - will only query the metrics by specific names/namespaces 
> and return a Map of keys and metric values for a namespace
> * MetricsPublisher - as a set of "Publishers". Each publisher then could 
> publish() to separate medium (BigQueryClient/console/others)
> This would make it even easier to extend this code in the future.



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

Reply via email to