ATLAS Offline Software
Tools
PROCTools
python
testIfMatch.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
re,sys,os
6
7
import
subprocess
8
9
10
def
getOutputDictFromAMI
(tag):
11
try
:
12
from
pyAMI.pyAMI
import
AMI
13
amires = AMI().
execute
([
"ListConfigurationTag"
,
"-configTag=%s"
% tag])
14
d = amires.getDict()[
'rowset_%s'
%tag][tag]
15
outDict = eval(d.get(
'outputs'
,
'None'
))
16
except
Exception
as
e:
17
print
(
"Failed to get OutputDict from AMI"
)
18
print
(e)
19
return
None
20
return
outDict
21
22
23
def
getTaskNamesFromCastor
():
24
#cdirs=("/castor/cern.ch/grid/atlas/tzero/prod1/perm/data11_7TeV","/castor/cern.ch/grid/atlas/tzero/prod1/perm/data11_cos")
25
cdirs=(
"/castor/cern.ch/grid/atlas/tzero/prod1/perm/data11_hi"
,
"/castor/cern.ch/grid/atlas/tzero/prod1/perm/data11_7TeV"
)
26
27
tasknames=
set
()
28
for
d
in
cdirs:
29
proj=d.split(
"/"
)[-1]
30
cmd=
"nsls "
+d
31
(stat,out)=subprocess.getstatusoutput(cmd)
32
if
stat!=0:
33
print
(
"ERROR, could not get list of streams from castor directory"
,d)
34
print
(out)
35
return
None
36
for
stream
in
out.split(os.linesep):
37
tasknames.add(proj+
".00000000."
+stream+
".merge.RAW"
)
38
return
tasknames
39
40
41
42
if
__name__==
'__main__'
:
43
if
len(sys.argv)!=2:
44
print
(
"Syntax:"
)
45
print
(sys.argv[0],
"<ami-tag>"
)
46
sys.exit(-1)
47
48
tag=sys.argv[1]
49
print
(
"ifmatch matrix for AMI configuration tag"
,tag)
50
51
outDict=
getOutputDictFromAMI
(tag)
52
if
outDict
is
None
:
53
sys.exit(-1)
54
55
#print (outDict)
56
57
taskNames=
getTaskNamesFromCastor
()
58
if
taskNames
is
None
:
59
sys.exit(-1)
60
61
#print (streamList)
62
63
matrix=dict()
64
for
taskname
in
taskNames:
65
matrix[taskname]=dict()
66
67
for
name,outDef
in
outDict.items():
68
if
'ifMatch'
in
outDef:
69
print
(
"\n"
+name+
" ["
+ outDef[
'ifMatch'
] +
"]"
)
70
for
taskname
in
taskNames:
71
if
re.match(outDef[
'ifMatch'
],taskname):
72
print
(
"\t"
,taskname,
" MATCH"
)
73
matrix[taskname][name]=
True
74
else
:
75
matrix[taskname][name]=
False
76
77
78
79
print
(
"Inverse Matrix:"
)
80
for
tn,ops
in
matrix.items():
81
print
(tn[:-9]+
": "
, end=
''
)
82
#print (" %30s :" % tn[:-9], end='')
83
for
nm,s
in
ops.items():
84
if
s:
85
print
(nm[6:-4]+
" "
, end=
''
)
86
#print ("%8s " % nm[6:-4], end='')
87
#else:
88
# print (" ", end='')
89
print
(
""
)
90
python.testIfMatch.getTaskNamesFromCastor
def getTaskNamesFromCastor()
Definition:
testIfMatch.py:23
LArG4FSStartPointFilterLegacy.execute
execute
Definition:
LArG4FSStartPointFilterLegacy.py:20
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition:
bitmask.h:232
python.testIfMatch.getOutputDictFromAMI
def getOutputDictFromAMI(tag)
Definition:
testIfMatch.py:10
Generated on Sat Oct 25 2025 21:18:50 for ATLAS Offline Software by
1.8.18