ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/TWikiIB/makeDepMetrics.py
Revision: 1.2
Committed: Mon Sep 7 14:00:54 2009 UTC (15 years, 8 months ago) by geonmo
Content type: text/x-python
Branch: MAIN
Changes since 1.1: +34 -35 lines
Log Message:
Add the cycle summary

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     temp = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+self.url)
12     self.contents = temp.readlines()
13 geonmo 1.1
14     self.page.write("""
15     <!--
16     * Set MENU_ID = test
17     -->
18    
19     <style> /* <pre> */
20     %STARTSECTION{"css"}%
21    
22     #%MENU_ID% ul{
23     margin: 0px;
24     pading: 0px;
25     }
26    
27     #%MENU_ID% ul li{
28     position:relative;
29     list-style: none;
30     margin: 0px 0px 0px 15px;
31     float: left;
32     font-family: sans-serif;
33     font-weight: 800;
34     font-size: 12px;
35     }
36    
37     #%MENU_ID% ul ul li{
38     position:relative;
39     font-weight: 500;
40     float: none;
41     margin: 0px 0px 0px -40px;
42     pading: 0px;
43     border: none;
44     background-color: none;
45     border-top: 1px solid #F8F8F8;
46     border-bottom: 1px solid #C0C0C0;
47     }
48     #%MENU_ID%.msie ul ul li{
49     position:relative;
50     margin-left: 0px;
51     }
52    
53     #%MENU_ID% ul ul{
54     margin: 0px;
55     clear: left;
56     display: none;
57     position: absolute;
58     top: 20px;
59     left: 0px;
60     background-color: #E0E0E0;
61     border: 1px solid #808080;
62     width: 150px;
63     z-index:30;
64     }
65     #%MENU_ID%.msie ul ul{
66     width: 180px;
67     }
68    
69     #%MENU_ID% ul ul ul{
70     top: 5px;
71     left: 190px;
72     }
73    
74     #%MENU_ID% a:link,
75     #%MENU_ID% a:active,
76     #%MENU_ID% a:visited{
77     text-decoration: none;
78     color: #0E0E0E;
79     overflow: hidden;
80     }
81    
82     #%MENU_ID% ul ul a{
83     padding: 0px 2px 0px 5px;
84     display: block;
85     background-color: #DCDCDC;
86     z-index:20;
87     }
88    
89     #%MENU_ID% ul ul a:hover{
90     background-color: #0EEEEE;
91     }
92    
93     #%MENU_ID% ul ul a.linkSubMenu:link,
94     #%MENU_ID% ul ul a.linkSubMenu:active,
95     #%MENU_ID% ul ul a.linkSubMenu:visited{
96     font-weight: 800;
97     }
98     %ENDSECTION{"css"}%
99     /* </pre> */ </style>
100     """)
101    
102    
103    
104     def packlist(self):
105 geonmo 1.2 contents=self.contents
106     pack = [['Levels']]
107     j=0
108     writeflag = False
109     valueflag = False
110     if len(contents)==0 :
111     self.page.write('---+++++No data about metrics information.\n')
112     return pack
113     for line in contents :
114     if line =='# Levels\n' :
115     writeflag = True
116     continue
117     if line=='\n':
118     continue
119     matchLevel = re.search('[0-9]. ',line)
120     if matchLevel :
121     j = j + 1
122     temp = line.split()
123     pack.append(temp)
124     valueflag=True
125     continue
126     if valueflag :
127     if line=='\n' :
128     valueflag=False
129     continue
130     else :
131     temp =line.strip()
132     pack[j].extend(temp)
133 geonmo 1.1
134 geonmo 1.2 return pack
135 geonmo 1.1 # repack return list [[levels], [level1, [PACKEGE1,module1,module2,...], [PACKEGE2,module1,module2], ..],[level2,[],[],...] ...]
136     def repack(self,pack):
137     listlen = len(pack)
138     pack2 = [['Levels']]
139     countpack = 0
140     for i in range(1,listlen):
141     packname = [[str(i)]]
142     check = 1
143     for j in range(1,len(pack[i])):
144    
145     m = re.search('/',pack[i][j])
146     per = m.span()
147     title = pack[i][j][0:per[0]]
148     module = pack[i][j][per[1]:]
149     if j==1:
150     temp = []
151     temp.append(title)
152     packname.append(temp)
153     packname[check].append(module)
154     #print packname[0]
155     else:
156     if packname[check][0]==title:
157     #print 'it\'s work!'
158     packname[check].append(module)
159     else:
160     check = check + 1
161     temp = []
162     temp.append(title)
163     packname.append(temp)
164     packname[check].append(module)
165    
166     pack2.append(packname)
167     return pack2
168    
169     def dropdown(self,list):
170     self.page.write('<div id="test">\n\n')
171     listlen = len(list)
172     for level in range(1,listlen):
173     self.page.write(' * !'+str(list[level][0][0])+'\n')
174     for pack in range(1,len(list[level])):
175     self.page.write(' * !'+str(list[level][pack][0])+'\n')
176     for module in range(1,len(list[level][pack])):
177     self.page.write(' * [[https://macms01.cern.ch/ap/ignominy/'+self.arch+'/'+self.package_name+'/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')
178     self.page.write('</div>\n%INCLUDE{"Main.DropDownMenu" section="js" MENU_ID="test"}%\n<br><br>\n\n')
179    
180    
181    
182     if __name__=="__main__" :
183     from makeDepMetrics import mkDepMetrics
184     mkDM = mkDepMetrics('t','slc4_ia32_gcc345','CMSSW_3_1_X_2009-08-05-1200')
185     pkglist = mkDM.packlist()
186     outputlist = mkDM.repack(pkglist)
187     mkDM.dropdown(outputlist)
188