Apply Rally patch (switch to threading for tasks) 79/70479/1
authorCédric Ollivier <cedric.ollivier@orange.com>
Mon, 8 Jun 2020 08:16:32 +0000 (10:16 +0200)
committerCédric Ollivier <cedric.ollivier@orange.com>
Mon, 6 Jul 2020 11:02:06 +0000 (13:02 +0200)
Change-Id: I8f4df2d4c220edc538c743cccce8050efe4a1140
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
(cherry picked from commit bfd0063c81f5d5d4fad2389832c8f1479a28f73d)
(cherry picked from commit fbac166c0010ac15835ba37260b94e3c705e339d)

docker/core/Dockerfile
docker/core/Switch-to-threading.Thread-for-Rally-tasks.patch [new file with mode: 0644]

index 447ca97..8518686 100644 (file)
@@ -5,6 +5,7 @@ ARG OPENSTACK_TAG=stable/rocky
 ARG OPNFV_TAG=stable/hunter
 
 COPY Try-a-quick-fix-vs-asynchronuous-issues.patch /tmp/Try-a-quick-fix-vs-asynchronuous-issues.patch
+COPY Switch-to-threading.Thread-for-Rally-tasks.patch /tmp/Switch-to-threading.Thread-for-Rally-tasks.patch
 RUN apk --no-cache add --update python py-pip bash git grep libffi openssl mailcap && \
     apk --no-cache add --virtual .build-deps --update \
         python-dev build-base libffi-dev openssl-dev && \
@@ -16,9 +17,10 @@ RUN apk --no-cache add --update python py-pip bash git grep libffi openssl mailc
         -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$OPNFV_TAG \
         -chttps://opendev.org/openstack/requirements/raw/branch/$OPENSTACK_TAG/upper-constraints.txt \
         /src/functest-kubernetes && \
+    (cd /usr/lib/python2.7/site-packages/rally && patch -p2 < /tmp/Switch-to-threading.Thread-for-Rally-tasks.patch) && \
     (cd /usr/lib/python2.7/site-packages/xrally_kubernetes/ && \
         patch -p2 < /tmp/Try-a-quick-fix-vs-asynchronuous-issues.patch) && \
-    rm -rf /src/functest-kubernetes && \
+    rm -rf /src/functest-kubernetes /tmp/Switch-to-threading.Thread-for-Rally-tasks.patch && \
     bash -c "mkdir -p /var/lib/xtesting /home/opnfv" && \
     ln -s /var/lib/xtesting /home/opnfv/functest && \
     mkdir -p /etc/rally && \
diff --git a/docker/core/Switch-to-threading.Thread-for-Rally-tasks.patch b/docker/core/Switch-to-threading.Thread-for-Rally-tasks.patch
new file mode 100644 (file)
index 0000000..a6d0127
--- /dev/null
@@ -0,0 +1,49 @@
+From 0d0ca00e56024a9919c150dbed62050d4c70b0c8 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?C=C3=A9dric=20Ollivier?= <cedric.ollivier@orange.com>
+Date: Wed, 3 Jun 2020 15:23:59 +0200
+Subject: [PATCH] Switch to threading.Thread() for Rally tasks
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+multiprocessing.Process() often fails due to thread crashes [1].
+It looks similar to gsutil release notes [2].
+
+[1] https://build.opnfv.org/ci/job/functest-opnfv-functest-benchmarking-cntt-latest-rally_full_cntt-run/35/console
+[2] https://github.com/GoogleCloudPlatform/gsutil/issues/548
+[3] https://github.com/GoogleCloudPlatform/gsutil/blob/master/CHANGES.md
+
+Change-Id: I582933832e23d188c7fa5999e713dd5d7e82d2da
+Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
+---
+ rally/task/runner.py | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/rally/task/runner.py b/rally/task/runner.py
+index 3397e1193..5edebb406 100644
+--- a/rally/task/runner.py
++++ b/rally/task/runner.py
+@@ -17,6 +17,7 @@ import abc
+ import collections
+ import copy
+ import multiprocessing
++import threading
+ import time
+ from rally.common import logging
+@@ -186,9 +187,9 @@ class ScenarioRunner(plugin.Plugin, validation.ValidatablePluginMixin,
+         for i in range(processes_to_start):
+             kwrgs = {"processes_to_start": processes_to_start,
+                      "processes_counter": i}
+-            process = multiprocessing.Process(target=worker_process,
+-                                              args=next(worker_args_gen),
+-                                              kwargs={"info": kwrgs})
++            process = threading.Thread(target=worker_process,
++                                       args=next(worker_args_gen),
++                                       kwargs={"info": kwrgs})
+             process.start()
+             process_pool.append(process)
+-- 
+2.26.2
+