Rename 'size' parameter into 'progression'

Change-Id: I9926aaa4f2e00c52f93a9ae3c7c0b061a10e0ae2
This commit is contained in:
Ilya Shakhat 2015-05-20 19:27:09 +03:00
parent 34836c583b
commit f6cdfccbd1
8 changed files with 16 additions and 15 deletions

View File

@ -8,7 +8,7 @@ deployment:
accommodation: [pair, double_room, density: 8, compute_nodes: 1] accommodation: [pair, double_room, density: 8, compute_nodes: 1]
execution: execution:
size: linear_progression progression: linear
tests: tests:
- -
title: Iperf TCP title: Iperf TCP

View File

@ -7,7 +7,7 @@ deployment:
accommodation: [pair, double_room, density: 8, compute_nodes: 1] accommodation: [pair, double_room, density: 8, compute_nodes: 1]
execution: execution:
size: linear_progression progression: linear
tests: tests:
- -
title: Iperf TCP title: Iperf TCP

View File

@ -8,7 +8,7 @@ deployment:
accommodation: [pair, double_room, density: 8, compute_nodes: 1] accommodation: [pair, double_room, density: 8, compute_nodes: 1]
execution: execution:
size: linear_progression progression: linear
tests: tests:
- -
title: Iperf TCP title: Iperf TCP

View File

@ -7,7 +7,7 @@ deployment:
accommodation: [pair, single_room] accommodation: [pair, single_room]
execution: execution:
size: quadratic_progression progression: quadratic
tests: tests:
- -
title: Iperf TCP title: Iperf TCP

View File

@ -7,7 +7,7 @@ deployment:
accommodation: [pair, single_room] accommodation: [pair, single_room]
execution: execution:
size: quadratic_progression progression: quadratic
tests: tests:
- -
title: Iperf TCP title: Iperf TCP

View File

@ -8,7 +8,7 @@ deployment:
accommodation: [pair, single_room] accommodation: [pair, single_room]
execution: execution:
size: quadratic_progression progression: quadratic
tests: tests:
- -
title: Iperf TCP title: Iperf TCP

View File

@ -49,16 +49,16 @@ def _make_test_title(test):
return re.sub(r'[^\x21-\x7e\x80-\xff]+', '_', s).lower() return re.sub(r'[^\x21-\x7e\x80-\xff]+', '_', s).lower()
def _pick_agents(agents, size): def _pick_agents(agents, progression):
# slave agents do not execute any tests # slave agents do not execute any tests
agents = [a for a in agents.values() if a.get('mode') != 'slave'] agents = [a for a in agents.values() if a.get('mode') != 'slave']
if not size or size == 'full': if not progression:
yield agents yield agents
elif size == 'linear_progression': elif progression in ['arithmetic', 'linear', 'linear_progression']:
for i in range(len(agents)): for i in range(len(agents)):
yield agents[:i + 1] yield agents[:i + 1]
elif size == 'quadratic_progression': elif progression in ['geometric', 'quadratic', 'quadratic_progression']:
n = len(agents) n = len(agents)
seq = [n] seq = [n]
while n > 1: while n > 1:
@ -75,8 +75,9 @@ def execute(quorum, execution, agents):
for test in execution['tests']: for test in execution['tests']:
LOG.debug('Running test %s on all agents', test) LOG.debug('Running test %s on all agents', test)
test_title = _make_test_title(test) test_title = _make_test_title(test)
progression = execution.get('progression', execution.get('size'))
for selected_agents in _pick_agents(agents, execution.get('size')): for selected_agents in _pick_agents(agents, progression):
executors = dict((a['id'], executors_classes.get_executor(test, a)) executors = dict((a['id'], executors_classes.get_executor(test, a))
for a in selected_agents) for a in selected_agents)

View File

@ -46,7 +46,7 @@ class TestServer(testtools.TestCase):
'id': i, 'mode': 'alone', 'node': 'uno', 'id': i, 'mode': 'alone', 'node': 'uno',
} }
picked = [set(a['id'] for a in arr) picked = [set(a['id'] for a in arr)
for arr in server._pick_agents(agents, 'full')] for arr in server._pick_agents(agents, None)]
self.assertEqual([set(range(10))], picked) self.assertEqual([set(range(10))], picked)
def test_pick_agents_full_filter_slaves(self): def test_pick_agents_full_filter_slaves(self):
@ -59,7 +59,7 @@ class TestServer(testtools.TestCase):
'id': 'slave_%s' % i, 'mode': 'slave', 'node': 'uno', 'id': 'slave_%s' % i, 'mode': 'slave', 'node': 'uno',
} }
picked = [set(a['id'] for a in arr) picked = [set(a['id'] for a in arr)
for arr in server._pick_agents(agents, 'full')] for arr in server._pick_agents(agents, None)]
self.assertEqual([set('master_%s' % i for i in range(10))], self.assertEqual([set('master_%s' % i for i in range(10))],
picked) picked)
@ -70,7 +70,7 @@ class TestServer(testtools.TestCase):
'id': i, 'mode': 'alone', 'node': 'uno', 'id': i, 'mode': 'alone', 'node': 'uno',
} }
picked = [set(a['id'] for a in arr) picked = [set(a['id'] for a in arr)
for arr in server._pick_agents(agents, 'linear_progression')] for arr in server._pick_agents(agents, 'linear')]
self.assertEqual([set(range(i + 1)) for i in range(0, 10)], self.assertEqual([set(range(i + 1)) for i in range(0, 10)],
picked) picked)
@ -82,7 +82,7 @@ class TestServer(testtools.TestCase):
} }
picked = [set(a['id'] for a in arr) picked = [set(a['id'] for a in arr)
for arr in server._pick_agents(agents, for arr in server._pick_agents(agents,
'quadratic_progression')] 'quadratic')]
self.assertEqual([set(range(1)), set(range(2)), self.assertEqual([set(range(1)), set(range(2)),
set(range(5)), set(range(10))], set(range(5)), set(range(10))],
picked) picked)