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

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

                Author: ASF GitHub Bot
            Created on: 05/May/20 09:07
            Start Date: 05/May/20 09:07
    Worklog Time Spent: 10m 
      Work Description: kamilwu commented on a change in pull request #11274:
URL: https://github.com/apache/beam/pull/11274#discussion_r419965963



##########
File path: sdks/python/apache_beam/io/gcp/pubsub_io_perf_test.py
##########
@@ -0,0 +1,195 @@
+#
+# 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.
+#
+
+"""
+Performance PubsubIO streaming test for Write/Read operations.
+
+Caution: only test runners (e.g. TestDataflowRunner) support matchers
+
+Example for TestDataflowRunner:
+
+python -m apache_beam.io.gcp.pubsub_io_perf_test \
+    --test-pipeline-options="
+    --runner=TestDataflowRunner
+    --sdk_location=.../dist/apache-beam-x.x.x.dev0.tar.gz
+    --project=<GCP_PROJECT_ID>
+    --temp_location=gs://<BUCKET_NAME>/tmp
+    --staging_location=gs://<BUCKET_NAME>/staging
+    --timeout=<TIME_IN_SECONDS>
+    --pubsub_name=<PUBSUB_NAME_TO_BE_CREATED>
+    --publish_to_big_query=<OPTIONAL><true/false>
+    --metrics_dataset=<OPTIONAL>
+    --metrics_table=<OPTIONAL>
+    --dataflow_worker_jar=<OPTIONAL>
+    --input_options='{
+      \"num_records\": <SIZE_OF_INPUT>
+      \"key_size\": 1
+      \"value_size\": <SIZE_OF_EACH_MESSAGE>
+    }'"
+"""
+
+# pytype: skip-file
+
+from __future__ import absolute_import
+
+import logging
+import sys
+
+from hamcrest import all_of
+
+import apache_beam as beam
+from apache_beam.io import Read
+from apache_beam.io import ReadFromPubSub
+from apache_beam.io.gcp.tests.pubsub_matcher import PubSubMessageMatcher
+from apache_beam.options.pipeline_options import PipelineOptions
+from apache_beam.testing.load_tests.load_test import LoadTest
+from apache_beam.testing.load_tests.load_test_metrics_utils import MeasureTime
+from apache_beam.testing.synthetic_pipeline import SyntheticSource
+from apache_beam.testing.test_pipeline import TestPipeline
+
+# pylint: disable=wrong-import-order, wrong-import-position
+try:
+  from google.cloud import pubsub
+except ImportError:
+  pubsub = None
+# pylint: enable=wrong-import-order, wrong-import-position
+
+
+class PubsubIOPerfTest(LoadTest):
+  def _setup_env(self):
+    def check_option(name):
+      if not self.pipeline.get_option(name):
+        logging.error('--%s argument is required.', name)
+        sys.exit(1)
+
+    check_option('timeout')
+    check_option('pubsub_name')
+
+    self.num_of_messages = int(self.input_options.get('num_records'))
+    self.size_of_messages = int(self.input_options.get('value_size'))
+    self.timeout = int(self.pipeline.get_option('timeout'))
+    self.pubsub_name = self.pipeline.get_option('pubsub_name')

Review comment:
       It'd good to put emphasis on _what_ is being created with this name. I 
suggest renaming this option to `topic_name`.




----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 430588)
    Time Spent: 8h 40m  (was: 8.5h)

> PubsubIO performance tests
> --------------------------
>
>                 Key: BEAM-9633
>                 URL: https://issues.apache.org/jira/browse/BEAM-9633
>             Project: Beam
>          Issue Type: Test
>          Components: sdk-py-core
>    Affects Versions: Not applicable
>            Reporter: Piotr Szuberski
>            Assignee: Piotr Szuberski
>            Priority: Major
>             Fix For: Not applicable
>
>          Time Spent: 8h 40m
>  Remaining Estimate: 0h
>
> There is no performance tests for PubsubIO in Python sdk



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

Reply via email to