def test_load_next_ready_for_pass_error(self): ed = ExperimentDefinition() self.addCleanup(self._del_table, "experiment") ed.create_table(self._db) ed_1 = ExperimentDefinition() ed_2 = ExperimentDefinition() ed_3 = ExperimentDefinition() ed_4 = ExperimentDefinition() ed_1._workflow_handling = "manifest" ed_1._work_state = "analysis_done" ed_2._workflow_handling = "multi" ed_2._work_state = "analysis_done" ed_3._workflow_handling = "multi" ed_3._work_state = "analysis_done" target_trace_id = ed_1.store(self._db) ed_2.store(self._db) ed_3.store(self._db) ed_4.store(self._db) #ed_1 to ed_4 should be skipped. ed_1b = ExperimentDefinition() ed_2b = ExperimentDefinition() ed_3b = ExperimentDefinition() ed_1b._workflow_handling = "manifest" ed_1b._work_state = "analysis_done" ed_2b._workflow_handling = "single" ed_2b._work_state = "analysis_done" ed_3b._workflow_handling = "multi" ed_3b._work_state = "analysis_done" target_trace_id_b = ed_1b.store(self._db) ed_2b.store(self._db) ed_3b.store(self._db) ed.load_next_ready_for_pass(self._db) self.assertEqual(target_trace_id_b, ed._trace_id)
def test_load_next_grouped_ready_for_pass(self): ed = GroupExperimentDefinition() self.addCleanup(self._del_table, "experiment") ed.create_table(self._db) other = ExperimentDefinition() other.store(self._db) subids_1 = [] for i in range(5): subt_1 = ExperimentDefinition() subt_1._workflow_handling = "manifest" subt_1._work_state = "analysis_done" subids_1.append(subt_1.store(self._db)) subids_2 = [] for i in range(5): subt_1 = ExperimentDefinition() subt_1._workflow_handling = "single" subt_1._work_state = "analysis_done" subids_2.append(subt_1.store(self._db)) subids_3 = [] for i in range(5): subt_1 = ExperimentDefinition() subt_1._workflow_handling = "single" subt_1._work_state = "analysis_done" subids_3.append(subt_1.store(self._db)) ed_1 = GroupExperimentDefinition() ed_2 = GroupExperimentDefinition() ed_3 = GroupExperimentDefinition() ed_4 = GroupExperimentDefinition() ed_1._workflow_handling = "manifest" ed_1._work_state = "analysis_done" ed_1._subtraces = subids_1 ed_2._workflow_handling = "single" ed_2._work_state = "analysis_done" ed_2._subtraces = subids_2 ed_3._workflow_handling = "multi" ed_3._work_state = "analysis_done" ed_3._subtraces = subids_3 target_trace_id = ed_1.store(self._db) ed_2.store(self._db) ed_3.store(self._db) #ed_4 should be skipped. ed_4.store(self._db) subids_1 = [] for i in range(5): subt_1 = ExperimentDefinition() subt_1._workflow_handling = "manifest" subt_1._work_state = "analysis_done" subids_1.append(subt_1.store(self._db)) subids_2 = [] for i in range(5): subt_1 = ExperimentDefinition() subt_1._workflow_handling = "single" subt_1._work_state = "analysis_done" subids_2.append(subt_1.store(self._db)) subids_3 = [] for i in range(5): subt_1 = ExperimentDefinition() subt_1._workflow_handling = "single" subt_1._work_state = "fresh" subids_3.append(subt_1.store(self._db)) ed_1 = GroupExperimentDefinition() ed_2 = GroupExperimentDefinition() ed_3 = GroupExperimentDefinition() ed_4 = GroupExperimentDefinition() ed_1._workflow_handling = "manifest" ed_1._work_state = "analysis_done" ed_1._subtraces = subids_1 ed_2._workflow_handling = "single" ed_2._work_state = "analysis_done" ed_2._subtraces = subids_2 ed_3._workflow_handling = "multi" ed_3._work_state = "analysis_done" ed_3._subtraces = subids_3 ed_1.store(self._db) ed_2.store(self._db) ed_3.store(self._db) #ed_4 should be skipped. ed_4.store(self._db) ed.load_next_ready_for_pass(self._db) self.assertEqual(target_trace_id, ed._trace_id) ed._work_state = "second_pass_done" ed.store(self._db) newEd = GroupExperimentDefinition() self.assertRaises(ValueError, newEd.load_next_ready_for_pass, self._db)