The Gaudi Framework
master (1a7a3838)
Toggle main menu visibility
Loading...
Searching...
No Matches
jsonFromLHCbLog.py
Go to the documentation of this file.
1
11
12
from
pygraph.classes.graph
import
graph
13
14
15
def
load_brunel_scenario
(filename):
16
gr = graph()
17
algs = {}
18
timing = {}
19
objs = []
20
curr =
None
21
order = 0
22
nodes = (
"/Event"
,
"/Event/Rec"
,
"/Event/DAQ"
)
23
for
l
in
open(filename).readlines():
24
if
l.find(
"StoreTracer"
) == 0:
25
if
l.find(
"Executing Algorithm"
) != -1:
26
alg = l.split()[-1]
27
if
alg
not
in
algs.keys():
28
algs[alg] = (order, set(), set())
29
curr = alg
30
order += 1
31
elif
l.find(
"Done with Algorithm"
) != -1:
32
curr =
None
33
elif
l.find(
"[EventDataSvc]"
) != -1
and
curr:
34
obj = l.split()[-1]
35
if
obj
in
nodes:
36
continue
37
if
obj.find(
"/Event/"
) == 0:
38
obj = obj[7:]
39
obj = obj.replace(
"/"
,
"_"
)
40
if
obj
not
in
objs:
41
objs.append(obj)
42
talg = algs[curr]
43
if
l.find(
"RETRIEVE"
) != -1:
44
if
obj
not
in
talg[1]:
45
talg[1].add(obj)
46
elif
l.find(
"REGOBJ"
) != -1:
47
if
obj
not
in
talg[2]:
48
talg[2].add(obj)
49
if
l.find(
"TimingAuditor"
) != -1:
50
algo = l.split()[2]
# .rstrip("|")
51
index = 13
52
if
algo.endswith(
"|"
):
53
index = 12
54
algo = algo.rstrip(
"|"
)
55
if
algo
in
algs.keys():
56
timing[algo] = l.split()[index]
57
else
:
58
for
name
in
algs.keys():
59
if
name.startswith(algo):
60
timing[name] = l.split()[index]
61
62
all_algos = []
63
for
i, (alg, deps)
in
enumerate(algs.items()):
64
if
alg
in
[
"PatPVOffline"
,
"PrsADCs"
]:
65
continue
66
if
deps[1]
or
deps[2]:
67
inputs = []
68
inputs = [
69
item
70
for
item
in
deps[1]
71
if
item
not
in
(
"DAQ_ODIN"
,
"DAQ_RawEvent"
)
and
item
not
in
deps[2]
72
]
73
outputs = [item
for
item
in
deps[2]]
74
new_algo = {
75
"name"
: alg,
76
"inputs"
: inputs,
77
"outputs"
: outputs,
78
"runtimes_wall"
: [float(timing[alg])],
79
}
80
all_algos.append(new_algo)
81
return
all_algos
82
83
84
85
if
__name__ ==
"__main__"
:
86
json = {}
87
json[
"algorithms"
] =
load_brunel_scenario
(
"Brunel.TES.trace.log"
)
88
print(json)
jsonFromLHCbLog.load_brunel_scenario
load_brunel_scenario(filename)
Definition
jsonFromLHCbLog.py:15
GaudiHive
options
jsonFromLHCbLog.py
Generated on
for The Gaudi Framework by
1.17.0