コード例 #1
0
 def create_dummy_nodes(obj):
     node_descriptions = [
         'NodeName=nid00001 Arch=x86_64 CoresPerSocket=12 '
         'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
         'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
         'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
         'NodeHostName=nid00001 Version=10.00 OS=Linux '
         'RealMemory=32220 AllocMem=0 FreeMem=10000 '
         'Sockets=1 Boards=1 State=MAINT+DRAIN '
         'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
         'MCS_label=N/A Partitions=p1,p2 '
         'BootTime=01 Jan 2018 '
         'SlurmdStartTime=01 Jan 2018 '
         'CfgTRES=cpu=24,mem=32220M '
         'AllocTRES= CapWatts=n/a CurrentWatts=100 '
         'LowestJoules=100000000 ConsumedJoules=0 '
         'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
         'ExtSensorsTemp=n/s Reason=Foo/ '
         'failed [reframe_user@01 Jan 2018]',
         'NodeName=nid00002 Arch=x86_64 CoresPerSocket=12 '
         'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
         'AvailableFeatures=f2,f3 ActiveFeatures=f2,f3 '
         'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00002 '
         'NodeHostName=nid00002 Version=10.00 OS=Linux '
         'RealMemory=32220 AllocMem=0 FreeMem=10000 '
         'Sockets=1 Boards=1 State=MAINT+DRAIN '
         'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
         'MCS_label=N/A Partitions=p2,p3'
         'BootTime=01 Jan 2018 '
         'SlurmdStartTime=01 Jan 2018 '
         'CfgTRES=cpu=24,mem=32220M '
         'AllocTRES= CapWatts=n/a CurrentWatts=100 '
         'LowestJoules=100000000 ConsumedJoules=0 '
         'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
         'ExtSensorsTemp=n/s Reason=Foo/ '
         'failed [reframe_user@01 Jan 2018]',
         'NodeName=nid00003 Arch=x86_64 CoresPerSocket=12 '
         'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
         'AvailableFeatures=f1,f3 ActiveFeatures=f1,f3 '
         'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00003'
         'NodeHostName=nid00003 Version=10.00 OS=Linux '
         'RealMemory=32220 AllocMem=0 FreeMem=10000 '
         'Sockets=1 Boards=1 State=MAINT+DRAIN '
         'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
         'MCS_label=N/A Partitions=p1,p3 '
         'BootTime=01 Jan 2018 '
         'SlurmdStartTime=01 Jan 2018 '
         'CfgTRES=cpu=24,mem=32220M '
         'AllocTRES= CapWatts=n/a CurrentWatts=100 '
         'LowestJoules=100000000 ConsumedJoules=0 '
         'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
         'ExtSensorsTemp=n/s Reason=Foo/ '
         'failed [reframe_user@01 Jan 2018]'
     ]
     return [SlurmNode(desc) for desc in node_descriptions]
コード例 #2
0
ファイル: test_schedulers.py プロジェクト: ikirker/reframe
 def test_no_node_name(self):
     with self.assertRaises(JobError):
         SlurmNode(self.no_name_node_description)
コード例 #3
0
ファイル: test_schedulers.py プロジェクト: ikirker/reframe
    def setUp(self):
        allocated_node_description = (
            'NodeName=nid00001 Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=ALLOCATED '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A Partitions=p1,p2 '
            'BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        idle_node_description = (
            'NodeName=nid00002 Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=IDLE '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A Partitions=p1,p2 '
            'BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        idle_drained_node_description = (
            'NodeName=nid00003 Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=IDLE+DRAIN '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A Partitions=p1,p2 '
            'BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        no_partition_node_description = (
            'NodeName=nid00004 Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=IDLE+DRAIN '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        self.no_name_node_description = (
            'Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=IDLE+DRAIN '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A Partitions=p1,p2 '
            'BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        self.allocated_node = SlurmNode(allocated_node_description)
        self.allocated_node_copy = SlurmNode(allocated_node_description)
        self.idle_node = SlurmNode(idle_node_description)
        self.idle_drained = SlurmNode(idle_drained_node_description)
        self.no_partition_node = SlurmNode(no_partition_node_description)
コード例 #4
0
ファイル: test_schedulers.py プロジェクト: ikirker/reframe
class TestSlurmNode(unittest.TestCase):
    def setUp(self):
        allocated_node_description = (
            'NodeName=nid00001 Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=ALLOCATED '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A Partitions=p1,p2 '
            'BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        idle_node_description = (
            'NodeName=nid00002 Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=IDLE '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A Partitions=p1,p2 '
            'BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        idle_drained_node_description = (
            'NodeName=nid00003 Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=IDLE+DRAIN '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A Partitions=p1,p2 '
            'BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        no_partition_node_description = (
            'NodeName=nid00004 Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=IDLE+DRAIN '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        self.no_name_node_description = (
            'Arch=x86_64 CoresPerSocket=12 '
            'CPUAlloc=0 CPUErr=0 CPUTot=24 CPULoad=0.00 '
            'AvailableFeatures=f1,f2 ActiveFeatures=f1,f2 '
            'Gres=gpu_mem:16280,gpu:1 NodeAddr=nid00001 '
            'NodeHostName=nid00001 Version=10.00 OS=Linux '
            'RealMemory=32220 AllocMem=0 FreeMem=10000 '
            'Sockets=1 Boards=1 State=IDLE+DRAIN '
            'ThreadsPerCore=2 TmpDisk=0 Weight=1 Owner=N/A '
            'MCS_label=N/A Partitions=p1,p2 '
            'BootTime=01 Jan 2018 '
            'SlurmdStartTime=01 Jan 2018 '
            'CfgTRES=cpu=24,mem=32220M '
            'AllocTRES= CapWatts=n/a CurrentWatts=100 '
            'LowestJoules=100000000 ConsumedJoules=0 '
            'ExtSensorsJoules=n/s ExtSensorsWatts=0 '
            'ExtSensorsTemp=n/s Reason=Foo/ '
            'failed [reframe_user@01 Jan 2018]'
        )

        self.allocated_node = SlurmNode(allocated_node_description)
        self.allocated_node_copy = SlurmNode(allocated_node_description)
        self.idle_node = SlurmNode(idle_node_description)
        self.idle_drained = SlurmNode(idle_drained_node_description)
        self.no_partition_node = SlurmNode(no_partition_node_description)

    def test_no_node_name(self):
        with self.assertRaises(JobError):
            SlurmNode(self.no_name_node_description)

    def test_states(self):
        self.assertEqual(self.allocated_node.states, {'ALLOCATED'})
        self.assertEqual(self.idle_node.states, {'IDLE'})
        self.assertEqual(self.idle_drained.states, {'IDLE', 'DRAIN'})

    def test_equals(self):
        self.assertEqual(self.allocated_node, self.allocated_node_copy)
        self.assertNotEqual(self.allocated_node, self.idle_node)

    def test_hash(self):
        self.assertEqual(hash(self.allocated_node),
                         hash(self.allocated_node_copy))

    def test_attributes(self):
        self.assertEqual(self.allocated_node.name, 'nid00001')
        self.assertEqual(self.allocated_node.partitions, {'p1', 'p2'})
        self.assertEqual(self.allocated_node.active_features, {'f1', 'f2'})
        self.assertEqual(self.no_partition_node.name, 'nid00004')
        self.assertEqual(self.no_partition_node.partitions, set())
        self.assertEqual(self.no_partition_node.active_features, {'f1', 'f2'})

    def test_str(self):
        self.assertEqual('nid00001', str(self.allocated_node))

    def test_is_available(self):
        self.assertFalse(self.allocated_node.is_available())
        self.assertTrue(self.idle_node.is_available())
        self.assertFalse(self.idle_drained.is_available())
        self.assertFalse(self.no_partition_node.is_available())

    def test_is_down(self):
        self.assertFalse(self.allocated_node.is_down())
        self.assertFalse(self.idle_node.is_down())
        self.assertTrue(self.no_partition_node.is_down())