ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
PerformanceMonitoring
PerfMonComps
python
PerfMonFlags.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3
# @file: PerfMonFlags.py
4
# @purpose: a container of flags for Performance Monitoring
5
# @author: Sebastien Binet <binet@cern.ch>
6
7
""" A container of flags for Performance Monitoring
8
9
"""
10
#
11
#
12
__author__ =
'Sebastien Binet'
13
__version__ =
"$Revision: 1.17 $"
14
__doc__ =
"A container of flags for Performance Monitoring"
15
16
from
AthenaCommon.JobProperties
import
JobProperty, JobPropertyContainer
17
from
AthenaCommon.JobProperties
import
jobproperties
18
19
#
20
class
doMonitoringMT
(JobProperty):
21
"""Flag to active the MT-safe monitoring framework and service(s)
22
It of course deactives serial monitoring
23
"""
24
statusOn =
False
25
allowedTypes = [
'bool'
]
26
StoredValue =
False
27
def
_do_action
(seld):
28
# Setup PerfMonMTSvc
29
from
AthenaCommon.AppMgr
import
ServiceMgr
as
svcMgr
30
if
not
hasattr(svcMgr,
'PerfMonMTSvc'
):
31
from
PerfMonComps.MTJobOptCfg
import
PerfMonMTSvc
32
svcMgr +=
PerfMonMTSvc
(
"PerfMonMTSvc"
)
33
return
34
35
def
_undo_action
(self):
36
# Uninstall the service and the algorithm
37
from
AthenaCommon.AppMgr
import
ServiceMgr
as
svcMgr
38
39
if
hasattr(svcMgr,
'PerfMonMTSvc'
):
40
del svcMgr.PerfMonMTSvc
41
return
42
#
43
class
doFastMonMT
(JobProperty):
44
""" Flag to active fast MT-safe monitoring framework and service(s)
45
It also activates the doMonitoringMT flag
46
"""
47
statusOn =
False
48
allowedTypes = [
'bool'
]
49
StoredValue =
False
50
def
_do_action
(self):
51
jobproperties.PerfMonFlags.doMonitoringMT =
True
52
return
53
54
#
55
class
doFullMonMT
(JobProperty):
56
""" Flag to activate full MT-safe monitoring framework and service(s)
57
It also activate the doMonitoringMT flag
58
Note that due to locks this functionality might negatively impact
59
concurrency
60
"""
61
statusOn =
False
62
allowedTypes = [
'bool'
]
63
StoredValue =
False
64
def
_do_action
(self):
65
jobproperties.PerfMonFlags.doMonitoringMT =
True
66
return
67
68
#
69
class
OutputJSON
(JobProperty):
70
""" Flag to override the default output file name of the perfmonmt json
71
"""
72
statusOn =
True
73
allowedTypes = [
'str'
]
74
StoredValue =
"perfmonmt.json"
75
76
# Defines the container for the performance monitoring flags
77
class
PerfMonFlags
(JobPropertyContainer):
78
""" The global performance monitoring flag/job property container.
79
"""
80
pass
81
82
# add the perfmon flags container to the top container
83
jobproperties.add_Container(PerfMonFlags)
84
85
86
# We want always the following flags in the container
87
list_jobproperties = [
88
doMonitoringMT,
89
doFastMonMT,
90
doFullMonMT,
91
OutputJSON,
92
]
93
94
for
i
in
list_jobproperties:
95
jobproperties.PerfMonFlags.add_JobProperty(i)
96
97
98
del list_jobproperties
99
100
101
def
_decode_pmon_opts
(opts, dry_run=False):
102
"""helper function to decode athena-command-line options.
103
104
@param opts is a list of options which can enable or disable a few
105
jobproperties.PerfMonFlags fields
106
107
@param dry_run to only decode but not set the options
108
109
one activates a perfmon flag by prepending '+' in front of the option name
110
(or nothing prepended, '+' being the implied default)
111
and de-activates it by prepending '-'.
112
"""
113
pmf = jobproperties.PerfMonFlags
114
dispatch = {
115
'perfmonmt'
: pmf.doMonitoringMT,
116
'fastmonmt'
: pmf.doFastMonMT,
117
'fullmonmt'
: pmf.doFullMonMT,
118
}
119
120
for
opt
in
opts:
121
flag_name = opt[:]
122
val =
True
123
if
opt.startswith(
'-'
):
124
val =
False
125
flag_name = flag_name[1:]
126
elif
opt.startswith(
'+'
):
127
val =
True
128
flag_name = flag_name[1:]
129
if
flag_name
not
in
dispatch:
130
raise
ValueError(
131
'[%s] is not a valid PerfMonFlag (allowed: %r)'
%
132
(flag_name, list(dispatch.keys()))
133
)
134
135
if
not
dry_run:
136
dispatch[flag_name].set_Value(val)
PerfMonMTSvc
Definition
PerfMonMTSvc.h:41
python.PerfMonFlags.OutputJSON
Definition
PerfMonFlags.py:69
python.PerfMonFlags.PerfMonFlags
Definition
PerfMonFlags.py:77
python.PerfMonFlags.doFastMonMT
Definition
PerfMonFlags.py:43
python.PerfMonFlags.doFastMonMT._do_action
_do_action(self)
Definition
PerfMonFlags.py:50
python.PerfMonFlags.doFullMonMT
Definition
PerfMonFlags.py:55
python.PerfMonFlags.doFullMonMT._do_action
_do_action(self)
Definition
PerfMonFlags.py:64
python.PerfMonFlags.doMonitoringMT
Definition
PerfMonFlags.py:20
python.PerfMonFlags.doMonitoringMT._undo_action
_undo_action(self)
Definition
PerfMonFlags.py:35
python.PerfMonFlags.doMonitoringMT._do_action
_do_action(seld)
Definition
PerfMonFlags.py:27
python.PerfMonFlags._decode_pmon_opts
_decode_pmon_opts(opts, dry_run=False)
module clean-up
Definition
PerfMonFlags.py:101
Generated on
for ATLAS Offline Software by
1.17.0