aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/rally/rally.py
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-09-12 10:22:49 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2019-09-14 10:24:17 +0200
commitc1b25e9a487436c75d2f0fd625b95c6c59563e64 (patch)
tree749df2e322aee5f48ae9e0730939124a3614c38a /functest/opnfv_tests/openstack/rally/rally.py
parentfe79a7a341bf99d33853ce49ad5536df5ce10a62 (diff)
Select python 3.6 as default
It switches to Python3 as default due to new OPNFV iruya release date (December) which is very closed to Python2 EOL. Functest Iruya (first release published in April) has supported both Python2 and Python3. Change-Id: I4c1294a5361e591fc7a8a88b3d067fc3b39e00c4 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/opnfv_tests/openstack/rally/rally.py')
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index 8100edaff..9a04f3873 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -22,7 +22,6 @@ import shutil
import subprocess
import time
-from threading import Timer
import pkg_resources
import prettytable
from ruamel.yaml import YAML
@@ -101,7 +100,6 @@ class RallyBase(singlevm.VmReady2):
self.run_cmd = ''
self.network_extensions = []
self.services = []
- self.task_aborted = False
def build_task_args(self, test_name):
"""Build arguments for the Rally task."""
@@ -425,25 +423,19 @@ class RallyBase(singlevm.VmReady2):
else:
LOGGER.info('Test scenario: "%s" Failed.', test_name)
- def kill_task(self, proc):
- """ Kill a task."""
- proc.kill()
- self.task_aborted = True
-
def run_task(self, test_name):
"""Run a task."""
LOGGER.info('Starting test scenario "%s" ...', test_name)
LOGGER.debug('running command: %s', self.run_cmd)
proc = subprocess.Popen(self.run_cmd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
- self.task_aborted = False
- timer = Timer(self.task_timeout, self.kill_task, [proc])
- timer.start()
- output = proc.communicate()[0]
- if self.task_aborted:
- LOGGER.error("Failed to complete task")
- raise Exception("Failed to complete task")
- timer.cancel()
+ try:
+ output = proc.communicate(timeout=self.task_timeout)[0]
+ except subprocess.TimeoutExpired:
+ proc.kill()
+ proc.communicate()
+ LOGGER.error("Failed to complete run task")
+ raise Exception("Failed to complete run task")
task_id = self.get_task_id(output)
LOGGER.debug('task_id : %s', task_id)
if task_id is None: