def test_scontrol_part_alloc(self):

        pattern_args = {'nname' : 'cream-34',
                        'nstate' : 'ALLOCATED+',
                        'ctot' : 4,
                        'calloc' : 4}

        tmpfile = self.workspace.createFile(self.nodePattern % pattern_args)
        
        pattern_args = {'nname' : 'cream-42',
                        'nstate' : 'IDLE',
                        'ctot' : 4,
                        'calloc' : 0}
        
        self.workspace.appendToFile(self.nodePattern % pattern_args, tmpfile)


        pattern_args = {'nname' : 'cream-46',
                        'nstate' : 'DOWN*',
                        'ctot' : 4,
                        'calloc' : 0}
        
        self.workspace.appendToFile(self.nodePattern % pattern_args, tmpfile)

        ncpu, freecpu = SControlInfoHandler.parseCPUInfo(tmpfile)

        self.assertTrue(ncpu == 8 and freecpu == 4)
예제 #2
0
    def test_scontrol_part_alloc(self):

        pattern_args = {
            'nname': 'cream-34',
            'nstate': 'ALLOCATED+',
            'ctot': 4,
            'calloc': 4
        }

        tmpfile = self.workspace.createFile(self.nodePattern % pattern_args)

        pattern_args = {
            'nname': 'cream-42',
            'nstate': 'IDLE',
            'ctot': 4,
            'calloc': 0
        }

        self.workspace.appendToFile(self.nodePattern % pattern_args, tmpfile)

        pattern_args = {
            'nname': 'cream-46',
            'nstate': 'DOWN*',
            'ctot': 4,
            'calloc': 0
        }

        self.workspace.appendToFile(self.nodePattern % pattern_args, tmpfile)

        ncpu, freecpu = SControlInfoHandler.parseCPUInfo(tmpfile)

        self.assertTrue(ncpu == 8 and freecpu == 4)
    def test_scontrol_config_ok(self):
    
        pattern_args = {'version' : '2.6.0',
                        'seltype' : 'select/cons_res',
                        'selpar' : 'CR_CPU'}

        tmpfile = self.workspace.createFile(self.configPattern % pattern_args)
        
        container = SControlInfoHandler.parseConfiguration(tmpfile)
        
        result = container.selectType == 'select/cons_res'
        result = result and container.selectParams == 'CR_CPU'
        result = result and container.version == '2.6.0'
        
        self.assertTrue(result)
예제 #4
0
    def test_scontrol_config_ok(self):

        pattern_args = {
            'version': '2.6.0',
            'seltype': 'select/cons_res',
            'selpar': 'CR_CPU'
        }

        tmpfile = self.workspace.createFile(self.configPattern % pattern_args)

        container = SControlInfoHandler.parseConfiguration(tmpfile)

        result = container.selectType == 'select/cons_res'
        result = result and container.selectParams == 'CR_CPU'
        result = result and container.version == '2.6.0'

        self.assertTrue(result)
    def test_scontrol_all_free(self):
    
        pattern_args = {'nname' : 'cream-34',
                        'nstate' : 'IDLE',
                        'ctot' : 2,
                        'calloc' : 0}
        
        tmpfile = self.workspace.createFile(self.nodePattern % pattern_args)
        
        pattern_args['nname'] = 'cream-42'
        
        self.workspace.appendToFile(self.nodePattern % pattern_args, tmpfile)
        
        pattern_args['nname'] = 'cream-46'
        
        self.workspace.appendToFile(self.nodePattern % pattern_args, tmpfile)
        
        ncpu, freecpu = SControlInfoHandler.parseCPUInfo(tmpfile)

        self.assertTrue(ncpu == 6 and freecpu == 6)
예제 #6
0
    def test_scontrol_all_free(self):

        pattern_args = {
            'nname': 'cream-34',
            'nstate': 'IDLE',
            'ctot': 2,
            'calloc': 0
        }

        tmpfile = self.workspace.createFile(self.nodePattern % pattern_args)

        pattern_args['nname'] = 'cream-42'

        self.workspace.appendToFile(self.nodePattern % pattern_args, tmpfile)

        pattern_args['nname'] = 'cream-46'

        self.workspace.appendToFile(self.nodePattern % pattern_args, tmpfile)

        ncpu, freecpu = SControlInfoHandler.parseCPUInfo(tmpfile)

        self.assertTrue(ncpu == 6 and freecpu == 6)