def test_ancestors_cyclic(self): T1 = Join(self.wf_spec, 'T1') T2 = Simple(self.wf_spec, 'T2') T1.follow(self.wf_spec.start) T2.follow(T1) T1.connect(T2) self.assertEquals(T1.ancestors(), [self.wf_spec.start]) self.assertEquals(T2.ancestors(), [T1, self.wf_spec.start])
def test_3_retry(): spec, a1 = create_worlflow() eh = ErrorHandler(spec, resolution='retry') c1 = Simple(spec, 'compensator #1') c1.follow(eh) a1.connect_error_handler(eh) a2 = Simple(spec, 'Next task post error') a2.follow(a1) run_workflow(spec)
def test_1_fail(): spec, a1 = create_worlflow() a2 = Simple(spec, 'Next task post error') a2.follow(a1) eh = ErrorHandler(spec) c1 = Simple(spec, 'comp 1') c1.follow(eh) #c2 = Simple(spec, 'comp 2') #c2.follow(eh) a1.connect_error_handler(eh) run_workflow(spec)
def testAncestors(self): T1 = Simple(self.wf_spec, 'T1') T2A = Simple(self.wf_spec, 'T2A') T2B = Simple(self.wf_spec, 'T2B') M = Join(self.wf_spec, 'M') T3 = Simple(self.wf_spec, 'T3') T1.follow(self.wf_spec.start) T2A.follow(T1) T2B.follow(T1) T2A.connect(M) T2B.connect(M) T3.follow(M) self.assertEquals(T1.ancestors(), [self.wf_spec.start]) self.assertEquals(T2A.ancestors(), [T1, self.wf_spec.start]) self.assertEquals(T2B.ancestors(), [T1, self.wf_spec.start]) self.assertEquals(M.ancestors(), [T2A, T1, self.wf_spec.start, T2B]) self.assertEqual(len(T3.ancestors()), 5)
def testAncestors(self): T1 = Simple(self.wf_spec, "T1") T2A = Simple(self.wf_spec, "T2A") T2B = Simple(self.wf_spec, "T2B") M = Join(self.wf_spec, "M") T3 = Simple(self.wf_spec, "T3") T1.follow(self.wf_spec.start) T2A.follow(T1) T2B.follow(T1) T2A.connect(M) T2B.connect(M) T3.follow(M) self.assertEquals(T1.ancestors(), [self.wf_spec.start]) self.assertEquals(T2A.ancestors(), [T1, self.wf_spec.start]) self.assertEquals(T2B.ancestors(), [T1, self.wf_spec.start]) M_ancestors = M.ancestors() self.assertIn(T1, M_ancestors) self.assertIn(T2A, M_ancestors) self.assertIn(T2B, M_ancestors) self.assertIn(self.wf_spec.start, M_ancestors) self.assertEqual(len(T3.ancestors()), 5)