forked from luopingyi/xc_agent_platform_demo
live: 6 submits per hour (cycle cap 6, attempts 30, prechecks 60)
This commit is contained in:
@@ -60,7 +60,7 @@ class TestLiveCycle(unittest.TestCase):
|
||||
self.assertEqual(self.submitted_pairs(), [])
|
||||
|
||||
def test_attempt_cap_and_invalid_fallback(self):
|
||||
for value, expected in ((None, 15), ('bad', 15), ('0', 15), ('-1', 15), ('2', 2)):
|
||||
for value, expected in ((None, 30), ('bad', 30), ('0', 30), ('-1', 30), ('2', 2)):
|
||||
with self.subTest(value=value):
|
||||
_marked.clear()
|
||||
self.client.reset_mock()
|
||||
@@ -71,10 +71,10 @@ class TestLiveCycle(unittest.TestCase):
|
||||
self.assertEqual(decisions[-1]['reason'], 'attempt_cap')
|
||||
|
||||
def test_submit_cap_counts_successes_after_rejections(self):
|
||||
self.client.submit.side_effect = [dict(http_status=200, platform_code=c) for c in (60020, 0, 60028, 0, 0)]
|
||||
decisions = self.cycle([candidate(str(i)) for i in range(7)], (1,) * 5)
|
||||
self.assertEqual(self.client.submit.call_count, 5)
|
||||
self.assertEqual(sum(d['action'] == 'submitted' for d in decisions), 3)
|
||||
self.client.submit.side_effect = [dict(http_status=200, platform_code=c) for c in (60020, 0, 60028, 0, 0, 0, 0, 0)]
|
||||
decisions = self.cycle([candidate(str(i)) for i in range(10)], (1,) * 8)
|
||||
self.assertEqual(self.client.submit.call_count, 8)
|
||||
self.assertEqual(sum(d['action'] == 'submitted' for d in decisions), 6)
|
||||
self.assertEqual(decisions[-1]['reason'], 'cycle_cap')
|
||||
|
||||
def test_task_limit_stops_cycle(self):
|
||||
@@ -110,9 +110,10 @@ class TestLiveCycle(unittest.TestCase):
|
||||
self.assertIn('[live] hold', self.logs.getvalue())
|
||||
|
||||
def test_order_and_cap(self):
|
||||
rows = [candidate('b'), candidate('a', 'A'), candidate('verified', 'A', 'verified_reuse'), candidate('c'), candidate('d')]
|
||||
self.cycle(rows, (90, 90, 90))
|
||||
self.assertEqual([c.args[0]['modelAddress'] for c in self.client.submit.call_args_list], ['org/verified', 'org/a', 'org/b'])
|
||||
rows = [candidate('b'), candidate('a', 'A'), candidate('verified', 'A', 'verified_reuse'), candidate('c'), candidate('d'), candidate('e'), candidate('f'), candidate('g')]
|
||||
self.cycle(rows, (90,) * 6)
|
||||
self.assertEqual([c.args[0]['modelAddress'] for c in self.client.submit.call_args_list],
|
||||
['org/verified', 'org/a', 'org/b', 'org/c', 'org/d', 'org/e'])
|
||||
self.assertIn('cycle_cap', self.logs.getvalue())
|
||||
|
||||
def test_midcycle(self):
|
||||
|
||||
Reference in New Issue
Block a user