-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Expand file tree
/
Copy pathbeam_PerformanceTests_xlang_KafkaIO_Python.yml
More file actions
194 lines (170 loc) · 8.56 KB
/
Copy pathbeam_PerformanceTests_xlang_KafkaIO_Python.yml
File metadata and controls
194 lines (170 loc) · 8.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# 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.
name: PerformanceTests xlang KafkaIO Python
on:
schedule:
- cron: '30 11 * * *'
workflow_dispatch:
# Setting explicit permissions for the action to avoid the default permissions which are `write-all` in case of pull_request_target event
permissions:
actions: write
pull-requests: read
checks: read
contents: read
deployments: read
id-token: none
issues: read
discussions: read
packages: read
pages: read
repository-projects: read
security-events: read
statuses: read
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.issue.number || github.sha || github.head_ref || github.ref }}-${{ github.event.schedule || github.event.comment.id || github.event.sender.login }}'
cancel-in-progress: true
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GE_CACHE_PASSWORD }}
INFLUXDB_USER: ${{ secrets.INFLUXDB_USER }}
INFLUXDB_USER_PASSWORD: ${{ secrets.INFLUXDB_USER_PASSWORD }}
jobs:
# Using 'PerfTests' instead of 'PerformanceTests' to comply with Kafka Strimzi's name length limitations.
beam_PerfTests_xlang_KafkaIO_Python:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'schedule' && github.repository == 'apache/beam') ||
github.event.comment.body == 'Run Python xlang KafkaIO Performance Test'
runs-on: [self-hosted, ubuntu-24.04, highmem]
timeout-minutes: 240
name: ${{ matrix.job_name }} (${{ matrix.job_phrase }})
strategy:
matrix:
job_name: ["beam_PerfTests_xlang_KafkaIO_Python"]
job_phrase: ["Run Python xlang KafkaIO Performance Test"]
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Setup repository
uses: ./.github/actions/setup-action
with:
comment_phrase: ${{ matrix.job_phrase }}
github_token: ${{ secrets.GITHUB_TOKEN }}
github_job: ${{ matrix.job_name }} (${{ matrix.job_phrase }})
- name: Setup environment
uses: ./.github/actions/setup-environment-action
with:
java-version: default
python-version: default
- name: Set k8s access
uses: ./.github/actions/setup-k8s-access
with:
cluster_name: kafka-workflows
k8s_namespace: ${{ matrix.job_name }}-${{ github.run_id }}
cluster_zone: us-central1
- name: Install Kafka
id: install_kafka
run: |
echo "Deploying Kafka cluster using existing .test-infra/kubernetes/kafka-cluster configuration..."
kubectl apply -R -f ${{ github.workspace }}/.test-infra/kubernetes/kafka-cluster/
# Wait for pods to be created and ready
echo "Waiting for Kafka cluster to be ready..."
sleep 180
# Check pod status
echo "Checking pod status..."
kubectl get pods -l app=kafka
kubectl get pods -l app=zookeeper
# Wait for at least one Kafka pod to be ready
echo "Waiting for Kafka pods to be ready..."
kubectl wait --for=condition=ready pod -l app=kafka --timeout=300s || echo "Kafka pods not ready, continuing anyway"
# Wait for Zookeeper to be ready
echo "Waiting for Zookeeper pods to be ready..."
kubectl wait --for=condition=ready pod -l app=zookeeper --timeout=300s || echo "Zookeeper pods not ready, continuing anyway"
- name: Set up Kafka brokers
id: set_brokers
run: |
echo "Setting up Kafka brokers for existing cluster configuration..."
declare -a kafka_service_brokers
declare -a kafka_service_brokers_ports
for INDEX in {0..2}; do
echo "Setting up broker ${INDEX}..."
# Try to get LoadBalancer IP
LB_IP=$(kubectl get svc outside-${INDEX} -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null || echo "")
if [ -n "$LB_IP" ] && [ "$LB_IP" != "null" ]; then
echo "Using LoadBalancer IP: $LB_IP"
kafka_service_brokers[$INDEX]=$LB_IP
else
echo "LoadBalancer IP not available, using NodePort approach..."
# Get the first node's internal IP
NODE_IP=$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
kafka_service_brokers[$INDEX]=$NODE_IP
fi
# Get the port
PORT=$(kubectl get svc outside-${INDEX} -o jsonpath='{.spec.ports[0].port}' 2>/dev/null || echo "9094")
kafka_service_brokers_ports[$INDEX]=$PORT
echo "KAFKA_SERVICE_BROKER_${INDEX}=${kafka_service_brokers[$INDEX]}" >> $GITHUB_OUTPUT
echo "KAFKA_SERVICE_BROKER_PORTS_${INDEX}=${kafka_service_brokers_ports[$INDEX]}" >> $GITHUB_OUTPUT
echo "Broker ${INDEX}: ${kafka_service_brokers[$INDEX]}:${kafka_service_brokers_ports[$INDEX]}"
done
- name: Create Kafka topic
id: create_topic
run: |
echo "Creating Kafka topic 'beam'..."
# Get the first available Kafka pod
KAFKA_POD=$(kubectl get pods -l app=kafka -o jsonpath='{.items[0].metadata.name}' 2>/dev/null || echo "")
if [ -z "$KAFKA_POD" ]; then
echo "No Kafka pods found, skipping topic creation"
exit 0
fi
echo "Using Kafka pod: $KAFKA_POD"
# Wait a bit more for the pod to be fully operational
echo "Waiting for pod to be fully operational..."
sleep 60
# Create the topic using the correct container and path
echo "Creating topic 'beam'..."
kubectl exec $KAFKA_POD -c broker -- /opt/kafka/bin/kafka-topics.sh --create --topic beam --zookeeper zookeeper:2181 --partitions 1 --replication-factor 1 || echo "Topic may already exist"
# Verify topic was created
echo "Verifying topic creation..."
kubectl exec $KAFKA_POD -c broker -- /opt/kafka/bin/kafka-topics.sh --list --zookeeper zookeeper:2181 || echo "Could not list topics"
- name: Prepare test arguments
uses: ./.github/actions/test-arguments-action
with:
test-type: load
test-language: python
argument-file-paths: |
${{ github.workspace }}/.github/workflows/performance-tests-pipeline-options/xlang_KafkaIO_Python.txt
arguments: |
--test_class=KafkaIOPerfTest
--kafka_topic=beam
--bootstrap_servers=${{ steps.set_brokers.outputs.KAFKA_SERVICE_BROKER_0 }}:${{ steps.set_brokers.outputs.KAFKA_SERVICE_BROKER_PORTS_0 }},${{ steps.set_brokers.outputs.KAFKA_SERVICE_BROKER_1 }}:${{ steps.set_brokers.outputs.KAFKA_SERVICE_BROKER_PORTS_1 }},${{ steps.set_brokers.outputs.KAFKA_SERVICE_BROKER_2 }}:${{ steps.set_brokers.outputs.KAFKA_SERVICE_BROKER_PORTS_2 }}
--read_timeout=3000
--filename_prefix=gs://temp-storage-for-perf-tests/${{ matrix.job_name }}/${{github.run_id}}/
- name: run shadowJar
uses: ./.github/actions/gradle-command-self-hosted-action
with:
gradle-command: :sdks:java:io:expansion-service:shadowJar
# The env variable is created and populated in the test-arguments-action as "<github.job>_test_arguments_<argument_file_paths_index>"
- name: run integrationTest
uses: ./.github/actions/gradle-command-self-hosted-action
with:
gradle-command: :sdks:python:apache_beam:testing:load_tests:run
arguments: |
-Prunner=DataflowRunner \
-PloadTest.mainClass=apache_beam.io.external.xlang_kafkaio_perf_test \
-PpythonVersion=3.10 \
'-PloadTest.args=${{ env.beam_PerfTests_xlang_KafkaIO_Python_test_arguments_1 }}'