MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / test_split_tasks

Method test_split_tasks

tests/explorer/scheduler_test.py:649–691  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

647 await scheduler.stop()
648
649 async def test_split_tasks(self):
650 self.config.explorer.max_repeat_times_per_runner = 2
651 self.config.check_and_update()
652 scheduler = Scheduler(self.config)
653 await scheduler.start()
654 exp_list = []
655
656 tasks = generate_tasks(4, repeat_times=8) # ceil(8 / 2) == 4
657 scheduler.schedule(tasks, batch_id=1)
658 statuses, exps = await collect_results(scheduler, batch_id=1)
659 self.assertEqual(len(statuses), 4)
660 self.assertEqual(len(exps), 4 * 8)
661 exp_list.extend(exps)
662 _, exps = await collect_results(scheduler, batch_id=1, min_num=1, timeout=1)
663 self.assertEqual(len(exps), 0)
664
665 tasks = generate_tasks(4, repeat_times=5) # ceil(5 / 2) == 3
666 scheduler.schedule(tasks, batch_id=2)
667 statuses, exps = await collect_results(scheduler, batch_id=2)
668 self.assertEqual(len(statuses), 4)
669 self.assertEqual(len(exps), 4 * 5)
670 exp_list.extend(exps)
671 _, exps = await collect_results(scheduler, batch_id=2, min_num=1, timeout=1)
672 self.assertEqual(len(exps), 0)
673
674 tasks = generate_tasks(3, repeat_times=1) # ceil(1 / 2) == 1
675 scheduler.schedule(tasks, batch_id=3)
676 statuses, exps = await collect_results(scheduler, batch_id=3)
677 self.assertEqual(len(statuses), 3)
678 self.assertEqual(len(exps), 3 * 1)
679 exp_list.extend(exps)
680 _, exps = await collect_results(scheduler, batch_id=3, min_num=1, timeout=1)
681 self.assertEqual(len(exps), 0)
682
683 # test task_id, run_id and unique_id
684 group_ids = [exp.eid.tid for exp in exp_list]
685 self.assertEqual(len(set(group_ids)), 11) # 4 + 4 + 3
686 run_ids = [exp.eid.rid for exp in exp_list]
687 self.assertEqual(len(run_ids), len(set(run_ids)))
688 unique_ids = [exp.eid.uid for exp in exp_list]
689 self.assertEqual(len(unique_ids), len(set(unique_ids)))
690
691 await scheduler.stop()
692
693 async def test_multi_step_execution(self):
694 self.config.explorer.max_repeat_times_per_runner = 1

Callers

nothing calls this directly

Calls 7

startMethod · 0.95
scheduleMethod · 0.95
stopMethod · 0.95
SchedulerClass · 0.90
generate_tasksFunction · 0.85
collect_resultsFunction · 0.85
check_and_updateMethod · 0.80

Tested by

no test coverage detected