Example #1
0
 def test_creation_scheduler(self):
     sched = PureScheduler()
     s = Seq(J(sl(1)), J(sl(2)), scheduler=sched)
     J(sl(3), required=s, scheduler=sched)
     # make sure that jobs appended in the sequence
     # even later on are also added to the scheduler
     s.append(J(sl(.5)))
     self.assertEqual(len(sched.jobs), 4)
     self.assertTrue(sched.check_cycles())
     self.assertTrue(sched.run())
Example #2
0
    def test_cycle(self):
        """a simple loop with 3 jobs - cannot handle that"""
        a1, a2, a3 = J(sl(1.1)), J(sl(1.2)), J(sl(1.3))
        a1.requires(a2)
        a2.requires(a3)
        a3.requires(a1)

        sched = PureScheduler(a1, a2, a3)

        # these lines seem to trigger a nasty message about a coro not being
        # waited
        self.assertFalse(sched.check_cycles())
Example #3
0
    def test_simple(self):
        """a simple topology, that should work"""
        jobs = SLJ(0.1), SLJ(0.2), SLJ(0.3), SLJ(0.4), SLJ(0.5), J(sl(0.6)), J(
            sl(0.7))
        a1, a2, a3, a4, a5, a6, a7 = jobs
        a4.requires(a1, a2, a3)
        a5.requires(a4)
        a6.requires(a4)
        a7.requires(a5)
        a7.requires(a6)

        sched = PureScheduler(*jobs)
        list_sep(sched, common_sep + "LIST BEFORE")
        self.assertTrue(sched.check_cycles())
        self.assertTrue(sched.run())
        for j in jobs:
            self.assertFalse(j.raised_exception())
        list_sep(sched, common_sep + "LIST AFTER")
        print(common_sep + "DEBRIEF")
        sched.debrief()