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

File Contents

# Content
1 #!/usr/bin/env python
2 import urllib2, re, os, sys
3 from ROOT import gROOT, TCanvas, TPie, TH1F, TLegend
4 class makePyCheck(object) :
5 def __init__(self,tday,arch,packagename) :
6 self.tday = tday
7 self.arch = arch
8 self.packagename = packagename
9 self.summary = self.packagename[6]+'.'+self.packagename[8]+'-'+self.tday+'-'+self.packagename[23:25]
10 url = 'http://cms-service-sdtweb.web.cern.ch/cms-service-sdtweb/rc/'+self.arch+'/www/'+self.tday+'/'+self.summary+'/'+self.packagename+'/testLogs/chkPyConf.log'
11 self.contents = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+url)
12
13 def makecanvas(self,name, xlen, ylen):
14 can = TCanvas(name,name,0,0,xlen,ylen)
15 can.SetFillColor(0)
16 can.SetFrameFillColor(0)
17 can.SetFrameLineWidth(2)
18 return can
19
20 def mkPyCheck(self) :
21
22 gROOT.Reset()
23
24 contents = self.contents
25 countpac = 0
26 title = []
27 countfiles = []
28 countfile = 0
29 countline = 0
30 while 1:
31 l = contents.readline()
32 if not l:
33 countfiles.append(countfile)
34 break
35 m1 = re.search('------',l)
36 if m1:
37 countpac = countpac + 1
38 countfiles.append(countfile)
39 countfile = 0
40 countline = countline + 1
41 m2 = re.search('Package',l)
42 if m2:
43 splitedline = l.split()
44 title.append(splitedline[1])
45 countfile = countfile + 1
46 print title
47 c1 = self.makecanvas("c1",300,200)
48 c2 = self.makecanvas("c2",600,400)
49 colors = [6,4,2,8,10,12]
50 num = []
51 for i in range(0,countline):
52 num.append(countfiles[i+1]-2)
53 print num
54
55 his1 = TH1F("pyCfgCheck","pyCfgCheck",countline,0,countline)
56 for j in range(0,countline):
57 titlenum = title[j]+' ('+str(num[j])+')'
58 his1.Fill(titlenum,float(num[j]))
59
60 pie = TPie(his1)
61 pie.SetRadius(0.35)
62 for j in range(0,countline):
63 pie.SetEntryFillColor(j,colors[j])
64 pie.SetTextSize(0.02)
65 pie.SetY(0.5)
66 pie.SetLabelsOffset(-.1)
67
68 pieleg = pie.MakeLegend()
69 pieleg.SetY1(0.80)
70 pieleg.SetY2(0.95)
71 pieleg.SetX1(0.5)
72 pieleg.SetX2(0.98)
73 pieleg.SetFillColor(0)
74 c1.cd()
75 pie.Draw("3d")
76 pieleg.Draw()
77 c1.Update()
78 c1.Print("pie_thum.png")
79 c2.cd()
80 pie.Draw("3d")
81 pieleg.Draw()
82 c2.Update()
83 c2.Print("pie.png")