ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/TWikiIB/makeDepMetrics.py
Revision: 1.3
Committed: Mon Sep 7 22:58:39 2009 UTC (15 years, 7 months ago) by geonmo
Content type: text/x-python
Branch: MAIN
Changes since 1.2: +27 -93 lines
Log Message:
Add the summary about cycles.

File Contents

# User Rev Content
1 geonmo 1.1 #!/usr/bin/env python
2     import re, os
3    
4     class mkDepMetrics(object) :
5 geonmo 1.2 def __init__(self, page, tday, arch, packagename) :
6 geonmo 1.1 self.page=page
7     self.tday = tday
8     self.arch = arch
9 geonmo 1.2 self.packagename = packagename
10     self.url = 'https://macms01.cern.ch/ap/ignominy/'+arch+'/'+packagename+'/igRun/metrics'
11 geonmo 1.3 temp = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+self.url)
12     self.contents=[]
13 geonmo 1.2 self.contents = temp.readlines()
14 geonmo 1.1
15 geonmo 1.3
16     def makeSummary(self):
17     contents=self.contents
18     writeflag = False
19     for line in contents :
20     print line
21     print
22     if line=='# Summary\n' :
23     writeflag = True
24     continue
25     if line=='# Levels\n' :
26     writeflag = False
27     return
28     if line=='\n' :
29     continue
30     if writeflag :
31     self.page.write(' * '+line)
32 geonmo 1.1
33    
34     def packlist(self):
35 geonmo 1.2 contents=self.contents
36     pack = [['Levels']]
37     j=0
38     writeflag = False
39     valueflag = False
40     if len(contents)==0 :
41     self.page.write('---+++++No data about metrics information.\n')
42     return pack
43     for line in contents :
44     if line =='# Levels\n' :
45     writeflag = True
46 geonmo 1.3 print line
47     continue
48     elif not writeflag :
49 geonmo 1.2 continue
50     if line=='\n':
51     continue
52     matchLevel = re.search('[0-9]. ',line)
53     if matchLevel :
54     j = j + 1
55     temp = line.split()
56     pack.append(temp)
57     valueflag=True
58     continue
59     if valueflag :
60     if line=='\n' :
61     valueflag=False
62     continue
63     else :
64     temp =line.strip()
65 geonmo 1.3 print temp
66     pack[j].append(temp)
67 geonmo 1.2 return pack
68 geonmo 1.1 # repack return list [[levels], [level1, [PACKEGE1,module1,module2,...], [PACKEGE2,module1,module2], ..],[level2,[],[],...] ...]
69     def repack(self,pack):
70 geonmo 1.3 #print pack
71 geonmo 1.1 listlen = len(pack)
72     pack2 = [['Levels']]
73     countpack = 0
74     for i in range(1,listlen):
75     packname = [[str(i)]]
76     check = 1
77     for j in range(1,len(pack[i])):
78    
79     m = re.search('/',pack[i][j])
80     per = m.span()
81     title = pack[i][j][0:per[0]]
82     module = pack[i][j][per[1]:]
83     if j==1:
84     temp = []
85     temp.append(title)
86     packname.append(temp)
87     packname[check].append(module)
88     #print packname[0]
89     else:
90     if packname[check][0]==title:
91     #print 'it\'s work!'
92     packname[check].append(module)
93     else:
94     check = check + 1
95     temp = []
96     temp.append(title)
97     packname.append(temp)
98     packname[check].append(module)
99    
100     pack2.append(packname)
101     return pack2
102    
103     def dropdown(self,list):
104 geonmo 1.3 self.page.write('\n<div id="test">\n\n')
105 geonmo 1.1 listlen = len(list)
106     for level in range(1,listlen):
107     self.page.write(' * !'+str(list[level][0][0])+'\n')
108     for pack in range(1,len(list[level])):
109     self.page.write(' * !'+str(list[level][pack][0])+'\n')
110     for module in range(1,len(list[level][pack])):
111 geonmo 1.3 self.page.write(' * [[https://macms01.cern.ch/ap/ignominy/'+self.arch+'/'+self.packagename+'/igRun/subsystem.'+str(list[level][pack][0])+'/PROJECT-'+str(list[level][pack][0])+'-'+str(list[level][pack][module].replace('/','-'))+'-O.gif.html]['+str(list[level][pack][module])+']]\n')
112 geonmo 1.1 self.page.write('</div>\n%INCLUDE{"Main.DropDownMenu" section="js" MENU_ID="test"}%\n<br><br>\n\n')
113    
114    
115    
116     if __name__=="__main__" :
117     from makeDepMetrics import mkDepMetrics
118     mkDM = mkDepMetrics('t','slc4_ia32_gcc345','CMSSW_3_1_X_2009-08-05-1200')
119     pkglist = mkDM.packlist()
120     outputlist = mkDM.repack(pkglist)
121     mkDM.dropdown(outputlist)
122