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

Diff of /nl.nikhef.ndpf.groupviews/trunk/ndpf-gv-mkplots

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2365 by templon, Sat Jul 23 11:05:32 2011 UTC revision 2366 by templon, Sat Jul 23 15:35:49 2011 UTC
# Line 12  colors = [ "#A6CEE3",  "#1F77B4",  "#B2D Line 12  colors = [ "#A6CEE3",  "#1F77B4",  "#B2D
12    
13  colors.reverse()  colors.reverse()
14    
15    timeargs = { 'hr'    : [ '-s', 'n-2h',  '-e', 'n' ],
16                 'day'   : [ '-s', 'n-24h', '-e', 'n' ],
17                 'week'  : [ '-s', 'n-8d', '-e', 'n' ],
18                 'month' : [ '-s', 'n-31d', '-e', 'n' ]
19                 }
20    
21  # for reference : resolutions of the RRAs  # for reference : resolutions of the RRAs
22  # 120s x 75 points = 2,5 hr  # 120s x 75 points = 2,5 hr
23  # 240s x 360 points = 24 hr  # 240s x 360 points = 24 hr
# Line 66  def doplot(grouplist, dbtype, psize, tim Line 72  def doplot(grouplist, dbtype, psize, tim
72                   'large' : [ '--imgformat', 'PNG', '--width', '950', '--height', '500' ]                   'large' : [ '--imgformat', 'PNG', '--width', '950', '--height', '500' ]
73                   }                   }
74    
     timeargs = { 'hr'  : [ '-s', 'n-2h',  '-e', 'n' ],  
                  'day' : [ '-s', 'n-24h', '-e', 'n' ]  
                  }  
75    
76      defs = list()      defs = list()
77      plots = list()      plots = list()
# Line 100  def doplot_wait(grouplist, dbtype, psize Line 103  def doplot_wait(grouplist, dbtype, psize
103                   'large' : [ '--imgformat', 'PNG', '--width', '950', '--height', '500' ]                   'large' : [ '--imgformat', 'PNG', '--width', '950', '--height', '500' ]
104                   }                   }
105    
     timeargs = { 'hr'  : [ '-s', 'n-2h',  '-e', 'n' ],  
                  'day' : [ '-s', 'n-24h', '-e', 'n' ]  
                  }  
   
106      defs = list()      defs = list()
107      plots = list()      plots = list()
108    
# Line 115  def doplot_wait(grouplist, dbtype, psize Line 114  def doplot_wait(grouplist, dbtype, psize
114    
115      for idx in range(len(grouplist)):      for idx in range(len(grouplist)):
116          group = grouplist[idx]          group = grouplist[idx]
117          pdefstr = 'LINE2' ':' + group + colors[idx] + ':' + group          pdefstr = 'LINE3' ':' + group + colors[idx] + ':' + group
118          if idx < 5 and psize == 'small':          if idx < 5 and psize == 'small':
119              pdefstr = pdefstr + '\g'              pdefstr = pdefstr + '\g'
120          plot_defs.append(pdefstr)          plot_defs.append(pdefstr)
# Line 135  for dbtype in ['queued', 'running', 'wai Line 134  for dbtype in ['queued', 'running', 'wai
134              else:              else:
135                  doplot(topgroups_day, dbtype, psize, timetag)                  doplot(topgroups_day, dbtype, psize, timetag)
136    
137    import time
138    now=int(time.mktime(time.localtime()))
139    end = (now / 14400 ) * 14400
140    start = end - (86400*31)
141    
142    import glob         # number of running jobs
143    
144    ### block finding 'top N' group list ###
145    
146    month_groups = dict() # structure day_group[groupname] = total of hourly average
147    
148    running_files = glob.glob(DATADIR+'*.running.rrd')
149    for db in running_files:
150        group = db[len(DATADIR):db.find('.running.rrd')]
151        if group == "total":
152            continue
153        tup = rrdtool.fetch(db,'AVERAGE','-r',"240",
154                            '-s', repr(start), '-e', repr(end))
155        vallist = [0] # start with zero, in case no vals returned, get zero as answer
156        for tup2 in tup[2]:
157            val = tup2[0]
158            if val:
159                vallist.append(val)
160        month_groups[group] = sum(vallist[:-1]) # chop weird last value from rrdtool
161            
162    month_groups_sorted = sorted(month_groups, key=month_groups.get, reverse=False)
163    topgroups_month=month_groups_sorted[-NUMGROUPS:]
164    
165    ### end block 'top N' group list ###
166    
167    for dbtype in ['queued', 'running', 'waittime']:
168        for psize in ['small', 'large']:
169            for timetag in ['week', 'month']:
170                if dbtype == 'waittime':
171                    doplot_wait(topgroups_month, dbtype, psize, timetag)
172                else:
173                    doplot(topgroups_month, dbtype, psize, timetag)
174  import sys  import sys
175  sys.exit(0)  sys.exit(0)
176    

Legend:
Removed from v.2365  
changed lines
  Added in v.2366

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