Renamed scheduller remove_item method to mark_test_complete

This commit is contained in:
Michael Elovskikh
2017-02-15 23:54:23 +05:00
parent c809406ef6
commit 4ed8161ef8
2 changed files with 9 additions and 9 deletions

View File

@@ -68,9 +68,9 @@ class TestEachScheduling:
assert sched.tests_finished assert sched.tests_finished
assert node1.sent == ['ALL'] assert node1.sent == ['ALL']
assert node2.sent == ['ALL'] assert node2.sent == ['ALL']
sched.remove_item(node1, 0) sched.mark_test_complete(node1, 0)
assert sched.tests_finished assert sched.tests_finished
sched.remove_item(node2, 0) sched.mark_test_complete(node2, 0)
assert sched.tests_finished assert sched.tests_finished
def test_schedule_remove_node(self, testdir): def test_schedule_remove_node(self, testdir):
@@ -113,7 +113,7 @@ class TestLoadScheduling:
assert len(node2.sent) == 1 assert len(node2.sent) == 1
assert node1.sent == [0] assert node1.sent == [0]
assert node2.sent == [1] assert node2.sent == [1]
sched.remove_item(node1, node1.sent[0]) sched.mark_test_complete(node1, node1.sent[0])
assert sched.tests_finished assert sched.tests_finished
def test_schedule_batch_size(self, testdir): def test_schedule_batch_size(self, testdir):
@@ -135,11 +135,11 @@ class TestLoadScheduling:
assert sched.node2pending[node1] == sent1 assert sched.node2pending[node1] == sent1
assert sched.node2pending[node2] == sent2 assert sched.node2pending[node2] == sent2
assert len(sched.pending) == 2 assert len(sched.pending) == 2
sched.remove_item(node1, 0) sched.mark_test_complete(node1, 0)
assert node1.sent == [0, 2, 4] assert node1.sent == [0, 2, 4]
assert sched.pending == [5] assert sched.pending == [5]
assert node2.sent == [1, 3] assert node2.sent == [1, 3]
sched.remove_item(node1, 2) sched.mark_test_complete(node1, 2)
assert node1.sent == [0, 2, 4, 5] assert node1.sent == [0, 2, 4, 5]
assert not sched.pending assert not sched.pending

View File

@@ -102,7 +102,7 @@ class EachScheduling:
self.node2pending[node] = pending self.node2pending[node] = pending
break break
def remove_item(self, node, item_index, duration=0): def mark_test_complete(self, node, item_index, duration=0):
self.node2pending[node].remove(item_index) self.node2pending[node].remove(item_index)
def remove_node(self, node): def remove_node(self, node):
@@ -143,7 +143,7 @@ class LoadScheduling:
when all collections are received it is verified they are when all collections are received it is verified they are
identical collections. Then the collection gets divided up in identical collections. Then the collection gets divided up in
chunks and chunks get submitted to nodes. Whenever a node finishes chunks and chunks get submitted to nodes. Whenever a node finishes
an item, it calls ``.remove_item()`` which will trigger the an item, it calls ``.mark_test_complete()`` which will trigger the
scheduler to assign more tests if the number of pending tests for scheduler to assign more tests if the number of pending tests for
the node falls below a low-watermark. the node falls below a low-watermark.
@@ -269,7 +269,7 @@ class LoadScheduling:
return return
self.node2collection[node] = list(collection) self.node2collection[node] = list(collection)
def remove_item(self, node, item_index, duration=0): def mark_test_complete(self, node, item_index, duration=0):
"""Mark test item as completed by node """Mark test item as completed by node
The duration it took to execute the item is used as a hint to The duration it took to execute the item is used as a hint to
@@ -661,7 +661,7 @@ class DSession:
the item from the pending list in the scheduler. the item from the pending list in the scheduler.
""" """
if rep.when == "call" or (rep.when == "setup" and not rep.passed): if rep.when == "call" or (rep.when == "setup" and not rep.passed):
self.sched.remove_item(node, rep.item_index, rep.duration) self.sched.mark_test_complete(node, rep.item_index, rep.duration)
# self.report_line("testreport %s: %s" %(rep.id, rep.status)) # self.report_line("testreport %s: %s" %(rep.id, rep.status))
rep.node = node rep.node = node
self.config.hook.pytest_runtest_logreport(report=rep) self.config.hook.pytest_runtest_logreport(report=rep)