示例#1
0
    def test_explain_queue(self):
        """Test explain queue"""
        app1 = scheduler.Application('foo.xxx#1',
                                     100,
                                     demand=[1, 1, 1],
                                     affinity='foo.xxx')
        app2 = scheduler.Application('bar.xxx#2',
                                     100,
                                     demand=[1, 1, 1],
                                     affinity='foo.xxx')
        app3 = scheduler.Application('bla.xxx#3',
                                     50,
                                     demand=[1, 1, 1],
                                     affinity='bla.xxx')

        (self.cell.partitions['_default'].allocation.get_sub_alloc(
            't1').get_sub_alloc('t3').get_sub_alloc('a2').add(app1))

        (self.cell.partitions['_default'].allocation.get_sub_alloc(
            't1').get_sub_alloc('t3').get_sub_alloc('a2').add(app2))

        (self.cell.partitions['part'].allocation.get_sub_alloc(
            't2').get_sub_alloc('a2').add(app3))

        df = reports.explain_queue(self.cell, '_default')
        self.assertEqual(len(df), 2 * 4)  # 2 apps at 4 alloc levels

        df = reports.explain_queue(self.cell, '_default', 'foo*')
        self.assertEqual(len(df), 4)  # 1 app at 4 alloc levels

        df = reports.explain_queue(self.cell, 'part')
        self.assertEqual(len(df), 3)  # 1 app at 3 alloc levels
示例#2
0
 def queue(instance, partition):
     """Explain the application queue"""
     cell_master = make_readonly_master()
     frame = reports.explain_queue(cell_master.cell,
                                   partition,
                                   pattern=instance)
     _print(frame, explain=True)