Unify RPS and constant runners and tune constant runner

The reason why we need to refactor constant runner are as follows:

1) using processes to genereate load is to expensive

The optimal way to do thing is to create N processes
(where N is amount of cpu) and use threads.

2) using multiprocessing.Pool() doesn't allow us to
make proper timeouts

3) using multprocessing.Pool() doesn't allow us to
stop imidiatelly load (when we run runner.abort())

What has also been done in this patch:

1) Unification of common part between rps and new constant
   runner

2) Using RAMInt for iterations counting in the RPS runner as well

3) Added a "sleep" parameter in Dummy.dummy_exception. This will allow us
   a better functional testing for the "--abort-on-sla-failure" feature.

4) Minor fix in SLA

ToDo in next patches:

* Implement timeouts
* Work on the constant for duration runner

Co-Authored-By: Boris Pavlovic <boris@pavlovic.me>
Co-Authored-By: Mikhail Dubov <mdubov@mirantis.com>

Change-Id: I49bcc8694e10b3bbb8dcf5c9fe52e29e48a985f3
This commit is contained in:
Boris Pavlovic 2015-02-09 15:54:19 +03:00 committed by Mikhail Dubov
parent 6e34a900c5
commit ec6131381d

View File

@ -351,8 +351,7 @@ class TaskTestCase(unittest.TestCase):
"deployment_id": deployment_id})
results = json.loads(rally("task results"))
iterations_completed = len(results[0]["result"])
# NOTE(msdubov): Change '<=' to '<' as soon as we fix the runners.
self.assertTrue(iterations_completed <= times)
self.assertTrue(iterations_completed < times)
def test_start_abort_on_sla_failure_max_seconds_constant(self):
times = 100
@ -421,6 +420,9 @@ class TaskTestCase(unittest.TestCase):
cfg = {
"Dummy.dummy_exception": [
{
"args": {
"sleep": 0.1
},
"runner": {
"type": "constant",
"times": times,
@ -439,6 +441,9 @@ class TaskTestCase(unittest.TestCase):
cfg = {
"Dummy.dummy_exception": [
{
"args": {
"sleep": 0.1
},
"runner": {
"type": "serial",
"times": times
@ -456,6 +461,9 @@ class TaskTestCase(unittest.TestCase):
cfg = {
"Dummy.dummy_exception": [
{
"args": {
"sleep": 0.1
},
"runner": {
"type": "rps",
"times": times,