/[pdpsoft]/nl.nikhef.ndpf.groupviews/trunk/mcpeil
ViewVC logotype

Annotation of /nl.nikhef.ndpf.groupviews/trunk/mcpeil

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2701 - (hide annotations) (download)
Thu Apr 24 15:17:33 2014 UTC (8 years, 5 months ago) by templon
File size: 1294 byte(s)
add database updater for mc pool

1 templon 2701 #!/usr/bin/env python
2     from torque_utils import pbsnodes
3    
4     import os
5     import sys
6     import subprocess
7    
8     wnodes = pbsnodes()
9     mcnodes = list()
10    
11     for node in wnodes:
12     if \
13     'mc' in node.properties \
14     and 'el6' not in node.properties \
15     and node.state.count('offline') == 0:
16     mcnodes.append(node)
17    
18     mcslots = 0
19     mcfree = 0
20     mcrun = 0
21    
22     qs = subprocess.Popen(('qstat', '-an1'), stdout=subprocess.PIPE)
23     qsout = qs.communicate()[0]
24     lines1 = qsout.split('\n')
25     lines = list()
26     nq = 0
27     for l in lines1:
28     if l.find(' Q ') > 0 and l.find('atlasmc') > 0 :
29     nq += 1
30     if l.find(' R ') > 0 :
31     lines.append(l)
32    
33    
34     for n in mcnodes:
35     mcslots += n.numCpu
36     mcfree += n.freeCpu
37     shortname = n.name.split('.')[0]
38     for l in lines:
39     if len(l) > 1 and l.find(shortname) > 0:
40     wnstr = l.split()[-1]
41     if wnstr.count('+') > 0 and l.count('atlb') > 0:
42     mcrun += wnstr.count('+') + 1
43    
44     import rrdtool
45     DATADIR=os.environ['HOME'] + '/ndpfdata/'
46    
47     rrdtool.update(DATADIR+'mcpool.rrd', 'N:%d' % (mcslots))
48     rrdtool.update(DATADIR+'mcqueued.rrd', 'N:%d' % (nq))
49     rrdtool.update(DATADIR+'unused.rrd', 'N:%d' % (mcfree))
50     rrdtool.update(DATADIR+'atlmc.rrd', 'N:%d' % (mcrun))
51     rrdtool.update(DATADIR+'nonmc.rrd', 'N:%d' % (mcslots - mcfree - mcrun))

Properties

Name Value
svn:executable *

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28