forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogUpdater.py
More file actions
executable file
·129 lines (108 loc) · 5.36 KB
/
logUpdater.py
File metadata and controls
executable file
·129 lines (108 loc) · 5.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/env python
import os
from cmsutils import doCmd, getIBReleaseInfo
class LogUpdater():
def __init__(self, dirIn=None, dryRun=False, remote="cmsbuild@cmssdtprod.cern.ch", webDir="/data/sdt/buildlogs/"):
self.dryRun = dryRun
self.remote = remote
self.cmsswBuildDir = dirIn
rel = os.path.basename(dirIn)
self.release = rel
rc, day, hour = getIBReleaseInfo (rel)
self.webTargetDir = webDir+"/"+os.environ["SCRAM_ARCH"]+"/www/"+day+"/"+rc+"-"+day+"-"+hour+"/"+self.release
self.ssh_opt = "-o CheckHostIP=no -o ConnectTimeout=60 -o ConnectionAttempts=5 -o StrictHostKeyChecking=no -o BatchMode=yes -o PasswordAuthentication=no"
return
def updateUnitTestLogs(self):
print "\n--> going to copy unit test logs to", self.webTargetDir, '... \n'
# copy back the test and relval logs to the install area
# check size first ... sometimes the log _grows_ to tens of GB !!
testLogs = ['unitTestLogs.zip','unitTests-summary.log','unitTestResults.pkl']
for tl in testLogs:
self.copyLogs(tl, '.', self.webTargetDir)
return
def updateGeomTestLogs(self):
print "\n--> going to copy Geom test logs to", self.webTargetDir, '... \n'
testLogs = ['dddreport.log', 'domcount.log']
for tl in testLogs:
self.copyLogs(tl, '.', self.webTargetDir)
self.copyLogs(tl, '.', os.path.join( self.webTargetDir, 'testLogs'))
return
def updateDupDictTestLogs(self):
print "\n--> going to copy dup dict test logs to", self.webTargetDir, '... \n'
testLogs = ['dupDict-*.log']
for tl in testLogs:
self.copyLogs(tl, '.', self.webTargetDir)
self.copyLogs(tl, '.', os.path.join( self.webTargetDir, 'testLogs'))
return
def updateLogFile(self,fileIn,subTrgDir=None):
desdir = self.webTargetDir
if subTrgDir: desdir = os.path.join(desdir, subTrgDir)
print "\n--> going to copy "+fileIn+" log to ", desdir, '... \n'
self.copyLogs(fileIn,'.', desdir)
return
def updateCodeRulesCheckerLogs(self):
print "\n--> going to copy cms code rules logs to", self.webTargetDir, '... \n'
self.copyLogs('codeRules', '.',self.webTargetDir)
return
def updateRelValMatrixPartialLogs(self, partialSubDir, dirToSend):
destination = os.path.join(self.webTargetDir,'pyRelValPartialLogs')
print "\n--> going to copy pyrelval partial matrix logs to", destination, '... \n'
self.copyLogs(dirToSend, partialSubDir, destination)
self.runRemoteCmd("touch "+os.path.join(destination,dirToSend,"wf.done"))
return
def relvalAlreadyDone(self, wf):
wfDoneFile = "wf.done"
destination = os.path.join(self.webTargetDir,'pyRelValPartialLogs',str(wf)+"_*",wfDoneFile)
code, out = self.runRemoteCmd ("ls -d "+destination)
return ((code == 0) and out.endswith(wfDoneFile))
def updateAddOnTestsLogs(self):
print "\n--> going to copy addOn logs to", self.webTargetDir, '... \n'
self.copyLogs('addOnTests.log' ,'.',self.webTargetDir)
self.copyLogs('addOnTests.zip' ,'addOnTests/logs',self.webTargetDir)
self.copyLogs('addOnTests.pkl' ,'addOnTests/logs',os.path.join(self.webTargetDir, 'addOnTests/logs'))
return
def updateIgnominyLogs(self):
print "\n--> going to copy ignominy logs to", self.webTargetDir, '... \n'
testLogs = ['dependencies.txt.gz','products.txt.gz','logwarnings.gz','metrics']
for tl in testLogs:
self.copyLogs(tl, 'igRun', os.path.join( self.webTargetDir, 'igRun'))
return
def updateProductionRelValLogs(self,workFlows):
print "\n--> going to copy Production RelVals logs to", self.webTargetDir, '... \n'
wwwProdDir = os.path.join( self.webTargetDir, 'prodRelVal')
self.copyLogs('prodRelVal.log' ,'.',wwwProdDir)
for wf in workFlows:
self.copyLogs('timingInfo.txt' ,'prodRelVal/wf/'+wf,os.path.join( wwwProdDir,'wf', wf))
return
def updateBuildSetLogs(self,appType='fwlite'):
print "\n--> going to copy BuildSet logs to", self.webTargetDir, '... \n'
wwwBSDir = os.path.join( self.webTargetDir, 'BuildSet')
self.copyLogs(appType ,'BuildSet',wwwBSDir)
return
def copyLogs(self, what, logSubDir, tgtDirIn):
self.runRemoteCmd("mkdir -p "+tgtDirIn)
self.copy2Remote(os.path.join(self.cmsswBuildDir, logSubDir, what),tgtDirIn+"/")
def runRemoteCmd(self, cmd):
return self.runRemoteHostCmd(cmd,self.remote)
def copy2Remote(self, src, des):
return self.copy2RemoteHost(src,des,self.remote)
def runRemoteHostCmd(self, cmd, host):
cmd ="ssh -Y "+self.ssh_opt+" "+host+" "+cmd
try:
if self.dryRun:
print "CMD>>",cmd
else:
return doCmd(cmd)
except Exception, e:
print "Ignoring exception during runRemoteCmd:", str(e)
return (1,str(e))
def copy2RemoteHost(self, src, des, host):
cmd ="scp "+self.ssh_opt+" -r "+src+" "+host+":"+des
try:
if self.dryRun:
print "CMD>>",cmd
else:
return doCmd(cmd)
except Exception, e:
print "Ignoring exception during copy2Remote:", str(e)
return (1,str(e))