/[pdpsoft]/nl.nikhef.ndpf.groupviews/trunk/ndpf-mc-mkplots
ViewVC logotype

Contents of /nl.nikhef.ndpf.groupviews/trunk/ndpf-mc-mkplots

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2702 - (show annotations) (download)
Mon Apr 28 13:28:46 2014 UTC (8 years, 3 months ago) by templon
File size: 4166 byte(s)
updates

1 #! /usr/bin/env python
2 # $Id: ndpf-gv-mkplots 2688 2014-01-21 16:20:14Z templon $
3 # Source: $URL: svn+ssh://svn@ndpfsvn.nikhef.nl/repos/pdpsoft/nl.nikhef.ndpf.groupviews/trunk/ndpf-gv-mkplots $
4 # J. A. Templon, NIKHEF/PDP 2011
5
6 import optparse
7
8 p = optparse.OptionParser(description="Program to make rrdtool plots " + \
9 "of performance of multicore pool")
10
11 # p.add_option("-r",action="store",dest="minsize",default='0',help="minimum size of dirs considered; can use suffixes k,M,G for multiples of 1000**{1,2,3} bytes")
12 # p.add_option("--qdel",action="store_true",dest="deljobs",help="delete jobs for which TMPDIR is larger than MINSIZE",default=False)
13
14 p.add_option("-r",action="store",dest="ranges",
15 help="comma-separated list of ranges to plot. Supported: hour, day, week, month, year, alltime",
16 default="day")
17 p.add_option("--rank-only",action="store_true",dest="rankonly",
18 help="don't plot, just print ranking of groups",default=False)
19
20 debug = 0
21
22 opts, args = p.parse_args()
23
24 timetags = opts.ranges.split(",")
25 import os
26
27 DATADIR=os.environ['HOME'] + '/ndpfdata/'
28 PLOTDIR='/www/grid/stats/groupviews/mcpool/'
29
30
31 import ndpf_gv_plots_common as plots
32
33 datafile_dict_run = {
34 'unused' : ('running', DATADIR + 'unused.mcpool.rrd'),
35 }
36
37 import glob
38 running_files = glob.glob(DATADIR+'*.running.mcpool.rrd')
39 for db in running_files:
40 group = db[len(DATADIR):db.find('.running.mcpool.rrd')]
41 datafile_dict_run[group] = ( 'running', db)
42
43 datafile_dict_cap = { 'capacity' : ('running', DATADIR + 'capacity.mcpool.rrd') }
44
45 tmpk = datafile_dict_run.keys()
46 tmpk.remove('unused')
47 tmpk.remove('nonmc')
48
49 datafile_dict_que = dict()
50 for k in tmpk:
51 datafile_dict_que[k] = ('queued', DATADIR + k + '.queued.mcpool.rrd')
52
53 tp = plots.Plot()
54
55 tp.colors = { 'unused' : plots.colors['stdgray'],
56 'nonmc' : plots.colors['lightgreen'],
57 'atlb' : plots.colors['darkorange'],
58 'datagrid' : plots.colors['lightorange'],
59 'capacity' : plots.colors['black']
60 }
61
62 tp.labels = dict()
63 for g in tp.colors:
64 tp.labels[g] = g
65
66 import sys
67 if opts.rankonly:
68 for t in timetags:
69 tgroup, pgroup = plots.getfracs(datafile_dict_run, datafile_dict_cap['capacity'],
70 plots.pdefs[t]['range'],
71 plots.pdefs[t]['res'])
72 groups_sorted = sorted(tgroup, key=tgroup.get, reverse=True) # decreasing useage towards end of list
73 idx = 0
74 print " group av.run %pool"
75 print " ----- ------ -----"
76 for k in groups_sorted:
77 idx += 1
78 print "%2d. %8s %5.1f %5.2f" % (idx, k, tgroup[k], pgroup[k])
79 sys.exit(0)
80
81 for t in timetags:
82 for qr in ['running', 'queued']:
83 if t != 'hour' and qr == 'running':
84 tgroup, pgroup = plots.getfracs(datafile_dict_run, datafile_dict_cap['capacity'],
85 plots.pdefs[t]['range'],
86 plots.pdefs[t]['res'])
87 for g in pgroup:
88 tp.labels[g] = "%-8s (%4.1f)" % (g, pgroup[g])
89 else:
90 for g in tp.colors:
91 tp.labels[g] = g
92 if qr == 'running':
93 tp.datafile = datafile_dict_run.copy()
94 tp.datafile.update(datafile_dict_cap)
95 tp.lines = ['capacity' ]
96 tp.bands = ['atlb', 'datagrid', 'nonmc', 'unused']
97 else:
98 tp.datafile = datafile_dict_que.copy()
99 tp.datafile.update(datafile_dict_que)
100 tp.lines = [ ]
101 tp.bands = ['atlb', 'datagrid']
102
103 for s in ['small', 'large']:
104
105 tp.width = plots.pdefs[t][s]['width']
106 tp.height = plots.pdefs[t][s]['height']
107 tp.opts = plots.pdefs[t][s]['opts']
108 tp.res = plots.pdefs[t]['res']
109 tp.range = plots.pdefs[t]['range']
110 tp.timeargs = plots.pdefs[t]['timeargs']
111 tp.plotfile = '%s%s-%s-%s-%s.png' % (PLOTDIR, 'mcpool', qr, t, s)
112
113 tp.generate()
114

Properties

Name Value
svn:executable *

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