From 8bb52e33d0c3c1224e363f030f597e08ba5fb17c Mon Sep 17 00:00:00 2001 From: Roman Vasilets Date: Thu, 19 Nov 2015 14:30:57 +0200 Subject: [PATCH] Fix timeout for scenario runners Timeout for scenario runners doesn't work correctly. To reproduce it just put in Dummy scenario args sleep bigger then timeout and it won't fail, that will verify this bug. Tasks are running in threads, so we need a way to kill threads. New function `terminate_thread` added for this purpose. Also added function that is run in separate thread and check execution time of the threads. If they run longer then timeout they would be terminated by terminate_thread. Thread can not be killed during system call, so this mechanism isn't 100% effective. Due to this interruptable_sleep method was added in order to be used by Dummy scenarios. Added timeout argument to constant and rps runners. Also added two Dummy scenarios to test this. New exception ThreadTimeoutException was added. Closes-Bug: #1385365 Co-Authored-By: Roman Vasilets Co-Authored-By: Sergey Scripnick Change-Id: I2096ba6adaf81a18c80b2ae6a759ccc9e247c45a --- rally-jobs/rally.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/rally-jobs/rally.yaml b/rally-jobs/rally.yaml index 3f79186d..c94b301a 100644 --- a/rally-jobs/rally.yaml +++ b/rally-jobs/rally.yaml @@ -658,6 +658,30 @@ type: "constant" times: 20 concurrency: 5 + - + args: + sleep: 30 + message: "This scenario should be terminated by runner timeout." + runner: + type: "constant" + times: 2 + concurrency: 2 + timeout: 1 + sla: + failure_rate: + min: 100 + - + args: + sleep: 30 + message: "This scenario should be terminated by runner timeout." + runner: + type: "rps" + times: 1 + rps: 1 + timeout: 1 + sla: + failure_rate: + min: 100 Dummy.dummy_exception_probability: -