mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-11 02:13:28 +08:00
Add km module kafka
This commit is contained in:
56
tests/kafkatest/services/trogdor/produce_bench_workload.py
Normal file
56
tests/kafkatest/services/trogdor/produce_bench_workload.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# 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 ducktape.services.service import Service
|
||||
from kafkatest.services.trogdor.task_spec import TaskSpec
|
||||
|
||||
|
||||
class ProduceBenchWorkloadSpec(TaskSpec):
|
||||
def __init__(self, start_ms, duration_ms, producer_node, bootstrap_servers,
|
||||
target_messages_per_sec, max_messages, producer_conf, admin_client_conf,
|
||||
common_client_conf, inactive_topics, active_topics,
|
||||
transaction_generator=None):
|
||||
super(ProduceBenchWorkloadSpec, self).__init__(start_ms, duration_ms)
|
||||
self.message["class"] = "org.apache.kafka.trogdor.workload.ProduceBenchSpec"
|
||||
self.message["producerNode"] = producer_node
|
||||
self.message["bootstrapServers"] = bootstrap_servers
|
||||
self.message["targetMessagesPerSec"] = target_messages_per_sec
|
||||
self.message["maxMessages"] = max_messages
|
||||
self.message["producerConf"] = producer_conf
|
||||
self.message["transactionGenerator"] = transaction_generator
|
||||
self.message["adminClientConf"] = admin_client_conf
|
||||
self.message["commonClientConf"] = common_client_conf
|
||||
self.message["inactiveTopics"] = inactive_topics
|
||||
self.message["activeTopics"] = active_topics
|
||||
|
||||
|
||||
class ProduceBenchWorkloadService(Service):
|
||||
def __init__(self, context, kafka):
|
||||
Service.__init__(self, context, num_nodes=1)
|
||||
self.bootstrap_servers = kafka.bootstrap_servers(validate=False)
|
||||
self.producer_node = self.nodes[0].account.hostname
|
||||
|
||||
def free(self):
|
||||
Service.free(self)
|
||||
|
||||
def wait_node(self, node, timeout_sec=None):
|
||||
pass
|
||||
|
||||
def stop_node(self, node):
|
||||
pass
|
||||
|
||||
def clean_node(self, node):
|
||||
pass
|
||||
Reference in New Issue
Block a user