This is an automated email from the ASF dual-hosted git repository.
snuyanzin pushed a commit to branch release-2.4
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-2.4 by this push:
new 411d015379d [hotfix][ci] Run pyflink tests in parallel
411d015379d is described below
commit 411d015379d3075ce49e35c5caec26bf8de36b20
Author: Sergey Nuyanzin <[email protected]>
AuthorDate: Sat Oct 31 15:23:18 2026 +0100
[hotfix][ci] Run pyflink tests in parallel
---
flink-python/conftest.py | 31 +++++++++++++++++++++++++++++++
flink-python/dev/integration_test.sh | 2 +-
flink-python/pyproject.toml | 1 +
3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/flink-python/conftest.py b/flink-python/conftest.py
new file mode 100644
index 00000000000..97eb595b463
--- /dev/null
+++ b/flink-python/conftest.py
@@ -0,0 +1,31 @@
+################################################################################
+# 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.
+################################################################################
+import os
+
+
+def pytest_configure(config):
+ # isolate gateway JVM logs per xdist worker
+ worker = os.environ.get("PYTEST_XDIST_WORKER")
+ if not worker:
+ return
+ from pyflink.pyflink_gateway_server import get_log_dir,
prepare_environment_variables
+ env = dict(os.environ)
+ prepare_environment_variables(env)
+ log_dir = os.path.join(get_log_dir(env), worker)
+ os.makedirs(log_dir, exist_ok=True)
+ os.environ["FLINK_LOG_DIR"] = log_dir
diff --git a/flink-python/dev/integration_test.sh
b/flink-python/dev/integration_test.sh
index 7bd9f34340c..8ad632cfde7 100755
--- a/flink-python/dev/integration_test.sh
+++ b/flink-python/dev/integration_test.sh
@@ -20,7 +20,7 @@
function test_module() {
module="$FLINK_PYTHON_DIR/pyflink/$1"
echo "test module $module"
- pytest --durations=20 ${module} $2
+ pytest -n ${PYFLINK_TEST_WORKERS:-4} --dist loadfile --durations=20
${module} $2
if [[ $? -ne 0 ]]; then
echo "test module $module failed"
exit 1
diff --git a/flink-python/pyproject.toml b/flink-python/pyproject.toml
index e8cd3815419..52f00c02308 100644
--- a/flink-python/pyproject.toml
+++ b/flink-python/pyproject.toml
@@ -50,6 +50,7 @@ dev = [
"httplib2>=0.19.0",
"protobuf>=6.31.1,<7.0.0.dev0",
"pytest~=8.0",
+ "pytest-xdist~=3.6",
"ruamel.yaml>=0.18.4",
"typing-extensions>=4.5.0; python_version < '3.12'",
"typing-extensions>=4.7.0; python_version >= '3.12'",