Ejemplo n.º 1
0
 def test_parsing_with_messages(self):
     file_name = 'tests/test/data/pbsnodes_message.txt'
     nr_nodes = 1
     warning_start = '### warning: message ERROR'
     warning_end = 'cleaned up on node r5i0n6\n'
     hostname = 'r5i0n6'
     loadave = '0.10'
     netload = '250792032533'
     state = 'free'
     nr_gpus = 0
     parser = PbsnodesParser(is_verbose=True)
     with open(file_name, 'r') as pbsnodes_file:
         os_stderr = sys.stderr
         sys.stderr = io.StringIO()
         node_infos = parser.parse_file(pbsnodes_file)
         warning_msg = sys.stderr.getvalue()
         sys.stderr = os_stderr
     self.assertEqual(nr_nodes, len(node_infos))
     self.assertEqual(warning_start, warning_msg[:len(warning_start)])
     self.assertEqual(warning_end, warning_msg[-len(warning_end):])
     node_info = node_infos[0]
     self.assertEqual(hostname, node_info.hostname)
     self.assertEqual(loadave, node_info.status['loadave'])
     self.assertEqual(netload, node_info.status['netload'])
     self.assertEqual(netload, node_info.status['netload'])
     self.assertEqual(state, node_info.state)
     self.assertEqual(nr_gpus, node_info.gpus)
     self.assertEqual(0, len(node_info.gpu_states))
Ejemplo n.º 2
0
 def test_parsing_gpu_node(self):
     file_name = 'tests/test/data/pbsnodes_gpu.txt'
     nr_nodes = 1
     np = 36
     hostname = 'r22g35'
     memory = 192494548 * 1024
     cpuload = 3.02 / 36
     nr_jobs = 3
     nr_gpus = 4
     gpu_states = [
         'Exclusive',
         'Exclusive',
         'Exclusive',
         'Unallocated',
     ]
     parser = PbsnodesParser()
     with open(file_name, 'r') as pbsnodes_file:
         node_infos = parser.parse_file(pbsnodes_file)
     self.assertEqual(nr_nodes, len(node_infos))
     node_info = node_infos[0]
     self.assertEqual(np, node_info.np)
     self.assertEqual(node_info.hostname, hostname)
     self.assertEqual(node_info.memory, memory)
     self.assertEqual(node_info.cpuload, cpuload)
     self.assertEqual(len(node_info.jobs), nr_jobs)
     self.assertEqual(4, len(node_info.gpu_status))
     self.assertEqual('38%', node_info.gpu_status[3]['gpu_utilization'])
     self.assertEqual('0%', node_info.gpu_status[0]['gpu_utilization'])
     self.assertEqual(nr_gpus, node_info.gpus)
     self.assertEqual(gpu_states, node_info.gpu_states)
Ejemplo n.º 3
0
 def test_parsing_with_messages(self):
     file_name = 'data/pbsnodes_message.txt'
     nr_nodes = 1
     warning_start = '### warning: message ERROR'
     warning_end = 'cleaned up on node r5i0n6\n'
     hostname = 'r5i0n6'
     loadave = '0.10'
     netload = '250792032533'
     state = 'free'
     parser = PbsnodesParser()
     with open(file_name, 'r') as pbsnodes_file:
         os_stderr = sys.stderr
         sys.stderr = StringIO.StringIO()
         node_infos = parser.parse_file(pbsnodes_file)
         warning_msg = sys.stderr.getvalue()
         sys.stderr = os_stderr
     self.assertEqual(nr_nodes, len(node_infos))
     self.assertEqual(warning_start,
                      warning_msg[:len(warning_start)])
     self.assertEqual(warning_end,
                      warning_msg[-len(warning_end):])
     node_info = node_infos[0]
     self.assertEqual(hostname, node_info.hostname)
     self.assertEqual(loadave, node_info.status['loadave'])
     self.assertEqual(netload, node_info.status['netload'])
     self.assertEqual(netload, node_info.status['netload'])
     self.assertEqual(state, node_info.state)
Ejemplo n.º 4
0
 def test_parsing(self):
     file_name = 'tests/test/data/pbsnodes.txt'
     nr_nodes = 173
     np = 20
     rack_str = 'r'
     parser = PbsnodesParser()
     with open(file_name, 'r') as pbsnodes_file:
         node_infos = parser.parse_file(pbsnodes_file)
     self.assertEqual(nr_nodes, len(node_infos))
     for node_info in node_infos:
         self.assertTrue(np <= node_info.np)
         self.assertTrue(node_info.hostname.startswith(rack_str))
Ejemplo n.º 5
0
 def test_parsing(self):
     file_name = 'data/pbsnodes.txt'
     nr_nodes = 173
     np = 20
     rack_str = 'r'
     parser = PbsnodesParser()
     with open(file_name, 'r') as pbsnodes_file:
         node_infos = parser.parse_file(pbsnodes_file)
     self.assertEqual(nr_nodes, len(node_infos))
     for node_info in node_infos:
         self.assertTrue(np <= node_info.np)
         self.assertTrue(node_info.hostname.startswith(rack_str))
Ejemplo n.º 6
0
 def test_parsing_nodes_down(self):
     file_name = 'tests/test/data/pbsnodes_down.txt'
     nr_nodes = 2
     hostnames = [
         'r22g41',
         'r24g35',
     ]
     states = ['down,offline', 'down']
     parser = PbsnodesParser(is_verbose=True)
     with open(file_name, 'r') as pbsnodes_file:
         node_infos = parser.parse_file(pbsnodes_file)
     self.assertEqual(nr_nodes, len(node_infos))
     for node_info, hostname, state in zip(node_infos, hostnames, states):
         self.assertEqual(hostname, node_info.hostname)
         self.assertEqual(state, node_info.state)
Ejemplo n.º 7
0
 def test_parsing_superdome(self):
     file_name = 'tests/test/data/pbsnodes_superdome.txt'
     nr_nodes = 1
     hostnames = [
         'tier2-p-superdome-1',
     ]
     states = [
         'job-exclusive',
     ]
     nps = [
         112,
     ]
     parser = PbsnodesParser(is_verbose=True)
     with open(file_name, 'r') as pbsnodes_file:
         node_infos = parser.parse_file(pbsnodes_file)
     self.assertEqual(nr_nodes, len(node_infos))
     for node_info, hostname, state, np in zip(node_infos, hostnames,
                                               states, nps):
         self.assertEqual(hostname, node_info.hostname)
         self.assertEqual(state, node_info.state)
         self.assertEqual(np, node_info.np)
Ejemplo n.º 8
0
import re
import sys
sys.path.append('./lib')

from vsc.pbs.pbsnodes import PbsnodesParser
#from vsc.pbs.node import NodeStatus

parser = PbsnodesParser()

#
# Next incarnation of this script will do the following:
# - loop over all accumulated pbsnodes files
#   - extract time from filename
# - keep track of various params as a function of node type
#   - node type: cyberlamp hi-mem, aci standard,...
#   - params: number of free cpus, number of sessions, other things
# - plot everything vs. time
#   - add average of each quantity to plot title

pbs_file = open("./pbsnodes.dat",'r')
nodes = parser.parse_file(pbs_file)

total_cpu = 0
total_sessions = 0

for node in nodes:
    if re.match(r'comp-clgc-0001',node.hostname):
#    if re.match(r'comp-cl',node.hostname):

        this_node_mem = 0
Ejemplo n.º 9
0
import re
import sys
sys.path.append('./lib')

from vsc.pbs.pbsnodes import PbsnodesParser
#from vsc.pbs.node import NodeStatus

parser = PbsnodesParser()

#
# Next incarnation of this script will do the following:
# - loop over all accumulated pbsnodes files
#   - extract time from filename
# - keep track of various params as a function of node type
#   - node type: cyberlamp hi-mem, aci standard,...
#   - params: number of free cpus, number of sessions, other things
# - plot everything vs. time
#   - add average of each quantity to plot title

pbs_file = open("./pbsnodes.dat", 'r')
nodes = parser.parse_file(pbs_file)

total_cpu = 0
total_sessions = 0

for node in nodes:
    if re.match(r'comp-clgc-0001', node.hostname):
        #    if re.match(r'comp-cl',node.hostname):

        this_node_mem = 0
Ejemplo n.º 10
0
 arg_parser.add_argument('--conf',
                         default=CFG_FILE,
                         help='configuration file to use')
 arg_parser.add_argument('--nodes',
                         action='store_true',
                         help='show comma-separated list of '
                         'host names the job is running on')
 arg_parser.add_argument('--verbose',
                         action='store_true',
                         help='show warnings')
 options = arg_parser.parse_args()
 job_id = get_numeric_job_id(options.job_id)
 with open(options.conf, 'r') as config_file:
     config = json.load(config_file)
 pbsnodes_output = subprocess.check_output(config['pbsnodes_cmd'])
 pbsnodes_parser = PbsnodesParser(options.verbose)
 nodes = pbsnodes_parser.parse(pbsnodes_output)
 loadaves = []
 mems = []
 netloads = []
 cput = None
 walltime = None
 core_count = 0
 node_names = []
 for node in nodes:
     if job_id in node.job_ids:
         loadaves.append(float(node.status['loadave']))
         mems.append(compute_memory(node))
         netloads.append(float(node.status['netload']))
         cpu_time = get_cpu_time(node, job_id)
         wall_time = get_walltime(node, job_id)