ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/TWikiIB/webcreate.py
Revision: 1.4
Committed: Thu Dec 17 05:51:35 2009 UTC (15 years, 4 months ago) by geonmo
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +2 -2 lines
Log Message:
Replace Release cycle(3.1,3.2->3.4,3.5)

File Contents

# User Rev Content
1 geonmo 1.1 #!/usr/bin/env python
2     import os, sys, time, re, urllib
3    
4     def getDummy() :
5     page = open('dummy.txt','r')
6     while 1:
7     line = page.readline()
8     if not line :
9     break
10     dummyit = re.compile('^---\+(\w*-\w*-\w*-\w*)')
11     dum = dummyit.match(line.strip())
12     if dum :
13     packagename = dum.group(1)
14     mkTwiki(0,0,packagename)
15    
16    
17    
18     def getPage() :
19     print "Webreader getPage Start!"
20     url = 'http://cms-service-sdtweb.web.cern.ch/cms-service-sdtweb/cgi-bin/showIB.py'
21     lines = []
22     page = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+url)
23    
24     lines=page.readline()
25     if not lines :
26     print ' Can not connect the server!\n Maybe you do not connect the internet. Please, use "--dummy" mode'
27     sys.exit (-2)
28     while(1) :
29     lines = page.readline()
30     if not lines:
31     break
32     if lines.strip()=='<th> <b>day</b> </th>' :
33     Twikifile.write('| *day* | *IB* | *builds* | *PyRelVals* | *Q/A Page* |\n')
34 geonmo 1.4 if lines.strip()=='<a name="3.4"/><h3> Release cycle 3.4 -- <a href="#top">back to top of page</a> </h3>' :
35 geonmo 1.1 Twikifile.write('---+++ Release cycle 3.1\n')
36 geonmo 1.4 if lines.strip()=='<a name="3.5"/><h3> Release cycle 3.5 -- <a href="#top">back to top of page</a> </h3>' :
37 geonmo 1.1 Twikifile.write('---+++ Release cycle 3.2\n')
38     if lines.strip()=='<a name="3.3"/><h3> Release cycle 3.3 -- <a href="#top">back to top of page</a> </h3>' :
39     Twikifile.write('---+++ Release cycle 3.3\n')
40    
41    
42    
43    
44     dayit = re.compile('(^<td>|^<td class=cellbold>) ([a-z][a-z][a-z]) </td>') # To get a day [ eg) mon, sat, sun... ]
45     day = dayit.match(lines.strip())
46     if day :
47     arch_status=[]
48     arch_name=[]
49     err_info=[]
50     err_status=[]
51     RV_status=[]
52     RV_info=[]
53     tday=day.group(2)
54     findit = re.compile('<a href="http://cern.ch/cms-sdt/cgi-bin/showQA.py/(\w*)/www/\w*/\w*.\w*-\w*-\w*/(\w*-\w*-\w*-\w*)')
55     findit2 = re.compile('<td><a class="(\w+)"> &nbsp; &nbsp;')
56     findit3 = re.compile('<font color=(\w+)>dictError : (\d+) </font><br /><font color=(\w+)>compError : (\d+) </font><br /><font color=(\w+)>linkError : (\d+) </font><br /><font color=(\w+)>pythonError : (\d+) </font><br /><font color=(\w+)>compWarning : (\d+) </font><br /><font color=(\w+)>dwnlError : (\d+) </font><br /><font color=(\w+)>miscError : (\d+) </font><br />')
57     findit4 = re.compile('>(slc4_\w+_\w+) </a>')
58     findit5 = re.compile('<font color=(\w+)>(\d+) RVs passed </font><br /><font color=(\w+)>(\d+) RVs failed</font>')
59     while(1) :
60     line = page.readline()
61 geonmo 1.3 if not line :
62     break
63 geonmo 1.1 mm = findit.search(line)
64     mm2 = findit2.search(line)
65     mm3 = findit3.search(line)
66     mm4 = findit4.search(line)
67     mm5 = findit5.search(line)
68     if mm :
69     packageinfo = { 'arch_name':arch_name, 'arch_status':arch_status, 'err_info':err_info, 'err_status':err_status, 'RV_status':RV_status, 'RV_info':RV_info }
70     arch = mm.group(1)
71     packagename = mm.group(2)
72     mkTwiki( tday, arch, packagename, packageinfo )
73     break
74     if mm2:
75     arch_status.append(mm2.group(1))
76     if mm3:
77     for x in range(1,8) :
78     err_info.append( mm3.group(2*x))
79     err_status.append( mm3.group(2*x-1))
80     if mm4:
81     arch_name.append( mm4.group(1) )
82     if mm5:
83     RV_status.append( mm5.group(1))
84     RV_status.append( mm5.group(3))
85     RV_info.append( mm5.group(2))
86     RV_info.append( mm5.group(4))
87    
88    
89    
90     page.close()
91     print "Webreader getPage End!"
92    
93     def InitIBTwiki() :
94     print 'IB Initialize\n'
95     import config
96     os.system('mv -f '+config.siteInfo['IBPath']+'CMSSW*.txt /home/nasera/backup')
97     Twikifile.write('''%META:TOPICINFO{author="GunmoRyu" date="1248773994" format="1.1" reprev="1.1" version="1.1"}%\n%META:TOPICPARENT{name="WebHome"}%\n''')
98     Twikifile.write('---+CMSSW integration builds\n')
99     Twikifile.write('''This page shows the build results for the CMSSW Integration Builds (formerly known as 'nightly').
100    
101     Hovering with the mouse over a link for the build or relval will show up a tooltip summarising the info. The tooltip will go away after 5 sec, or if you click on the "close" button (top right).
102    
103     As there are usually three !RelVals which run into a timeout, the threshold for "green" !RelVals is three.
104     ''')
105     Twikifile.write('---++Status of the builds\n')
106     version = 0
107    
108    
109     def EndIBTwiki() :
110     Twikifile.write('''
111     -- Main.GunmoRyu & Main.HyunYongKim - 28 Jul 2009\n
112     ''')
113     Twikifile.close()
114     import config
115     os.system('chown www-data.www-data '+config.siteInfo['IBPath']+'*')
116     os.system('cp '+config.siteInfo['IBPath']+'/*.txt '+config.siteInfo['TWikiDataDir'])
117     print "IB END!"
118    
119     def mkTwiki( day, arch, packagename,info):
120     print "webcreate mkTwiki start!"
121     arch_status=[]
122     for x in info['arch_status'] :
123     if x=='failed' :
124     arch_status.append('RED')
125     elif x=='warning' :
126     arch_status.append('YELLOW')
127     else :
128     arch_status.append('GREEN')
129    
130     summarytype = packagename[6]+'.'+packagename[8]+'-'+day+'-'+packagename[23:25]
131     number = len( info['arch_name'] )
132     for x in range( number/2 ):
133     if x==0:
134     Twikifile.write('| '+day+' | '+packagename+' | ')
135     else :
136     Twikifile.write('| ^ | ^ | ')
137    
138     Twikifile.write('%'+arch_status[x]+'% *@@@[[http://cern.ch/cms-sdt/rc/'+info['arch_name'][x]+'/www/'+day+'/'+summarytype+'/'+packagename+'/new]['+info['arch_name'][x]+']]* %ENDCOLOR% | ')
139     Twikifile.write('%'+arch_status[number/2+x]+'% *@@@[[http://cern.ch/cms-sdt//cgi-bin/showMatrixTestLogs-ap.py//'+info['arch_name'][number/2+x]+'/www/mon/'+summarytype+'/'+packagename+'/pyRelValMatrixLogs/run/]['+info['arch_name'][number/2+x]+']]* %ENDCOLOR% | ')
140     Twikifile.write('[['+packagename+'][QA Page]]|\n')
141    
142     from makeQAPage import mkQAPage
143     nb = mkQAPage(day,arch,packagename)
144     nb.makePage()
145     print "webcreate mkTwiki end!"
146    
147    
148    
149    
150     def usage() :
151     print 'usage',sys.argv[0],'--release <rel>'
152     print ""
153     return
154    
155     if __name__ == "__main__" :
156     import getopt
157     options = sys.argv[1:]
158     try:
159     opts, args = getopt.getopt(options, 'h',['help','dummy'])
160     except getopt.GetoptError:
161     usage()
162     sys.exit(-2)
163    
164     rel = None
165     dummy = False
166     for o,a in opts:
167     if o in ('-h','--help'):
168     usage()
169     sys.exit()
170     if o in('--dummy') :
171     dummy = True
172     import config
173     Twikifile = open(config.siteInfo['IBPath']+'IBQA.txt','w')
174     InitIBTwiki()
175     if dummy is False :
176     getPage()
177     else :
178     getDummy()
179    
180     EndIBTwiki()
181