ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tools
PROCTools
python
provideTwikiSummary.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4
5
import
os
6
7
def
readReleaseList
():
8
release_list = []
9
f = open(
'releaseList.txt'
,
'r'
)
10
for
line
in
f:
11
try
:
12
release_list.append(line.split()[0])
13
except
Exception:
14
pass
15
return
release_list
16
17
18
19
def
cleanDiffRoot
(ref, val,q, ftype, path):
20
logfile =
"%s/run_%s/diff-root-%s.%s.log"
%(path,q,q,ftype)
21
outfile =
"%s_vs_%s_diff-root-%s.%s.txt"
%(ref,val,q,ftype)
22
if
path:
23
outfile =
"%s/%s_vs_%s/%s"
%(path,ref,val,outfile)
24
command =
'cat %s | grep -v "diff= \\[" | grep -v "::sync-" > %s'
%(logfile,outfile)
25
#print (command)
26
os.system(command)
27
28
29
def
cleanLog
(ref, val, path, log):
30
#logfile = "/storage/users/mb1063/proc/checks_%s_vs_%s.log" %(ref,val)
31
logfile =
"%s/%s"
%(path,log)
32
outfile =
"%s_vs_%s_RunTier0Test.txt"
%(ref,val)
33
if
path:
34
outfile =
"%s/%s_vs_%s/%s"
%(path,ref,val,outfile)
35
command =
'cat %s > %s'
%(logfile,outfile)
36
#print (command)
37
os.system(command)
38
39
40
def
execDiffs
(ref, val, path=None):
41
filename =
"%s_vs_%s_tag-diff.txt"
%(ref,val)
42
command1 =
"get-tag-diff.py --ref=%s --chk=%s > %s/%s_vs_%s/%s"
%(ref,val,path,ref,val,filename)
43
print
(command1)
44
os.system(command1)
45
46
47
"""
48
interprets log ATTENTION not all results with breaks T0 is really braking it, please double check
49
"""
50
def
readLogFile
(path,log):
51
q221 =
"ok"
52
q431 =
"ok"
53
f = open(
"%s/%s"
%(path,log),
'r'
)
54
for
line
in
f:
55
if
"q221"
in
line
and
'break'
in
line:
56
q221 =
"breaks T0"
57
if
"q431"
in
line
and
'break'
in
line:
58
q431 =
"breaks T0"
59
return
q221, q431
60
61
"""
62
prints line for twiki table
63
"""
64
def
PrintTwiki
(ref, chk, q221, q431):
65
status =
"%Y%"
66
if
"break"
in
q221
or
"break"
in
q431:
67
status =
"%X%"
68
path =
"https://twiki.cern.ch/twiki/pub/Atlas/Tier0CacheReleases"
69
70
twiki =
"| [[%s/%s_vs_%s_tag-diff.txt][%s vs %s]] | [[%s/%s_vs_%s_diff-root-q221.ESD.txt][ESD diff]] [[%s/%s_vs_%s_diff-root-q221.AOD.txt][AOD diff]] | [[%s/%s_vs_%s_diff-root-q431.ESD.txt][ESD diff]] [[%s/%s_vs_%s_diff-root-q431.AOD.txt][AOD diff]] | [[%s/%s_vs_%s_RunTier0Test.txt][%s/%s]] | %s | |"
%(path,ref,chk,ref,chk,path,ref,chk,path,ref,chk,path,ref,chk,path,ref,chk,path,ref,chk,q221,q431,status)
71
print
(twiki)
72
return
0
73
74
75
76
77
"""
78
79
"""
80
def
execute_all_steps
(ref,val,path,log):
81
#path = "%s_vs_%s" %(ref,val)
82
83
os.system(
"mkdir %s/%s_vs_%s"
%(path,ref,val))
84
print
(
"INFO getting Tag diff of %s and %s"
%(ref,val))
85
execDiffs
(ref, val, path)
86
print
(
"INFO providing RunTier0Test log summary"
)
87
cleanLog
(ref,val, path,log)
88
print
(
"INFO providing short q221 ESD diff-root summary"
)
89
cleanDiffRoot
(ref,val,
"q221"
,
"ESD"
, path)
90
print
(
"INFO providing short q221 AOD diff-root summary"
)
91
cleanDiffRoot
(ref,val,
"q221"
,
"AOD"
, path)
92
print
(
"INFO providing short q431 ESD diff-root summary"
)
93
cleanDiffRoot
(ref,val,
"q431"
,
"ESD"
, path)
94
print
(
"INFO providing short q431 AOD diff-root summary"
)
95
cleanDiffRoot
(ref,val,
"q431"
,
"AOD"
, path)
96
97
q221, q431 =
readLogFile
(path,log)
98
PrintTwiki
(ref, val, q221, q431)
99
100
101
"""
102
execute diff for a list of releases to be compared
103
"""
104
def
writeManyFiles
(release_list):
105
for
idx,ref
in
enumerate(release_list):
106
try
:
107
val = release_list[idx+1]
108
except
Exception:
109
return
0
110
#print (rel, val)
111
execute_all_steps
(ref,val)
112
113
from
optparse
import
OptionParser
114
115
parser=OptionParser(usage=
"\n ./provideTwikiSummary.py -r 20.7.5.3 -v 20.7.5.4 -p <path with RunTier0Tests results> \n"
)
116
parser.add_option(
"-r"
,
"--ref"
,type=
"string"
,dest=
"ref"
,default=
None
,help=
"ref release"
)
117
parser.add_option(
"-v"
,
"--val"
,type=
"string"
,dest=
"val"
,default=
None
,help=
"val release"
)
118
parser.add_option(
"-p"
,
"--path"
,type=
"string"
,dest=
"path"
,default=
None
,help=
"path where RunTier0Tests was executed"
)
119
parser.add_option(
"-l"
,
"--log"
,type=
"string"
,dest=
"log"
,default=
"log"
,help=
"RunTier0Tests log"
)
120
parser.add_option(
"-f"
,
"--file"
,type=
"string"
,dest=
"file"
,default=
None
,help=
"file with list of releases"
)
121
(options,args)=parser.parse_args()
122
123
124
if
options.file:
125
release_list =
readReleaseList
()
126
#print (release_list)
127
writeManyFiles
(release_list)
128
129
if
options.ref
and
options.val:
130
execute_all_steps
(options.ref,options.val,options.path,options.log)
131
132
python.provideTwikiSummary.writeManyFiles
writeManyFiles(release_list)
Definition
provideTwikiSummary.py:104
python.provideTwikiSummary.execute_all_steps
execute_all_steps(ref, val, path, log)
Definition
provideTwikiSummary.py:80
python.provideTwikiSummary.readLogFile
readLogFile(path, log)
Definition
provideTwikiSummary.py:50
python.provideTwikiSummary.readReleaseList
readReleaseList()
Definition
provideTwikiSummary.py:7
python.provideTwikiSummary.PrintTwiki
PrintTwiki(ref, chk, q221, q431)
Definition
provideTwikiSummary.py:64
python.provideTwikiSummary.cleanLog
cleanLog(ref, val, path, log)
Definition
provideTwikiSummary.py:29
python.provideTwikiSummary.cleanDiffRoot
cleanDiffRoot(ref, val, q, ftype, path)
Definition
provideTwikiSummary.py:19
python.provideTwikiSummary.execDiffs
execDiffs(ref, val, path=None)
Definition
provideTwikiSummary.py:40
Generated on
for ATLAS Offline Software by
1.17.0