Exemplo n.º 1
0
    def test_requeue(self):
        """Requeue test.

        Same as previous example except that all tests are requeued
        once.
        """
        results = {}

        def collect(job):
            if job.uid not in results:
                results[job.uid] = True
                return True
            else:
                return False

        # This time test with two interdependent jobs
        dag = DAG()
        dag.add_vertex('1')
        dag.add_vertex('2')
        s = Scheduler(Scheduler.simple_provider(NopJob),
                      tokens=2, collect=collect)
        s.run(dag)
        assert s.max_active_jobs == 2
        assert results['1']
        assert results['2']
Exemplo n.º 2
0
 def test_minimal_run(self):
     """Test with only two independent jobs."""
     dag = DAG()
     dag.add_vertex('1')
     dag.add_vertex('2')
     s = Scheduler(Scheduler.simple_provider(NopJob), tokens=2)
     s.run(dag)
     assert s.max_active_jobs == 2
Exemplo n.º 3
0
 def test_minimal_run2(self):
     """Test with two interdependent jobs."""
     dag = DAG()
     dag.add_vertex('1')
     dag.add_vertex('2', predecessors=['1'])
     s = Scheduler(Scheduler.simple_provider(NopJob), tokens=2)
     s.run(dag)
     assert s.max_active_jobs == 1
Exemplo n.º 4
0
    def test_ordering(self):
        """Test that jobs are ordered correctly."""
        results = []

        def collect(job):
            results.append(job.uid)

        dag = DAG()
        dag.add_vertex("3")
        dag.add_vertex("0")
        dag.add_vertex("1")
        s = Scheduler(Scheduler.simple_provider(NopJob), tokens=1, collect=collect)
        s.run(dag)
        assert tuple(results) == ("0", "1", "3")