summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py
diff options
context:
space:
mode:
authorLuc Provoost <luc.provoost@intel.com>2020-09-17 17:17:36 +0200
committerLuc Provoost <luc.provoost@intel.com>2020-09-17 17:19:14 +0200
commit163323cd8f9eec2390099ca4834827a28c46c6db (patch)
treec09882a97e525c6a5c98a505cad0262a7378c792 /VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py
parentd092ffd38f9b5acafb740da11b5a2467ff972036 (diff)
Using python concurrent futures
Different PROX instances are now started in parallel. The script is starting multiple threads. Change-Id: Ia8785a792240d4e9b5d5d98174bc4c5d7ae5657c Signed-off-by: Luc Provoost <luc.provoost@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py')
-rwxr-xr-xVNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py b/VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py
index 023b4bc3..2c18b232 100755
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py
@@ -23,6 +23,8 @@ from future import standard_library
standard_library.install_aliases()
from builtins import object
import sys
+import concurrent.futures
+from concurrent.futures import ALL_COMPLETED
from rapid_cli import RapidCli
from rapid_log import RapidLog
from rapid_parser import RapidConfigParser
@@ -81,8 +83,11 @@ class RapidTestManager(object):
machines.append(machine)
if test_params['configonly']:
sys.exit()
- for machine in machines:
- machine.start_prox()
+ prox_executor = concurrent.futures.ThreadPoolExecutor(max_workers=len(machines))
+ future_to_prox = {prox_executor.submit(machine.start_prox): machine for machine in machines}
+ with concurrent.futures.ThreadPoolExecutor(max_workers=len(machines)) as executor:
+ future_to_connect_prox = {executor.submit(machine.connect_prox): machine for machine in machines}
+ concurrent.futures.wait(future_to_connect_prox,return_when=ALL_COMPLETED)
result = True
for test_param in test_params['tests']:
RapidLog.info(test_param['test'])
@@ -119,6 +124,8 @@ class RapidTestManager(object):
single_test_result = test.run()
if not single_test_result:
result = False
+ for machine in machines:
+ machine.close_prox()
return (result)
def main():