test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
Configuration
PyReleaseValidation
python
MatrixToProcess.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
4
class
MatrixToProcess
:
5
6
def
__init__
(self,what='standard',strict=True):
7
from
Configuration.PyReleaseValidation.MatrixReader
import
MatrixReader
8
self.
mrd
=
MatrixReader
(what,noRun=
True
)
9
self.mrd.prepare(
'all'
,
''
,
None
)
10
self.
configBuilders
={}
11
self.
processes
={}
12
self.
strict
=strict
13
def
getKey
(self,wfNumber,step):
14
return
str(wfNumber)+
':'
+str(step)
15
16
def
getProcess
(self,wfNumber,step):
17
key=self.
getKey
(wfNumber,step)
18
if
not
key
in
self.
configBuilders
:
19
self.
load
(wfNumber,step)
20
if
not
key
in
self.
configBuilders
:
21
return
None
22
return
self.
configBuilders
[key].process
23
24
def
load
(self,wfNumber,step):
25
from
Configuration.Applications.ConfigBuilder
import
ConfigBuilder
26
from
Configuration.Applications.cmsDriverOptions
import
OptionsFromCommand
27
import
copy
28
29
if
len(self.
configBuilders
)!=0
and
self.
strict
:
30
raise
Exception
(
'one should never be loading more than one process at a time due to python loading/altering feature'
)
31
key=self.
getKey
(wfNumber,step)
32
if
key
in
self.
configBuilders
:
33
return
True
34
35
for
wf
in
self.mrd.workFlows:
36
if
float(wf.numId)!=wfNumber:
continue
37
38
if
not
hasattr(wf,
'cmdStep%d'
%(step)):
continue
39
if
not
getattr(wf,
'cmdStep%d'
%(step)):
continue
40
41
command=getattr(wf,
'cmdStep%d'
%(step))
42
opt=
OptionsFromCommand
(command)
43
if
opt:
44
cb =
ConfigBuilder
(opt,with_input=
True
,with_output=
True
)
45
cb.prepare()
46
self.
configBuilders
[key]=copy.copy(cb)
47
return
True
48
print
"could not satisfy the request for step"
,step,
"of workflow"
,wfNumber
49
return
False
50
51
def
getConfig
(self,wfNumber,step):
52
key=self.
getKey
(wfNumber,step)
53
if
not
key
in
self.
configBuilders
: self.
getProcess
(wfNumber,step)
54
if
not
key
in
self.
configBuilders
:
return
None
55
return
self.
configBuilders
[key].pythonCfgCode
56
57
def
identityTest
(self,wfNumber,step):
58
self.
getProcess
(wfNumber,step)
59
key=self.
getKey
(wfNumber,step)
60
if
not
key
in
self.
configBuilders
:
return
None
61
62
cb=self.
configBuilders
[key]
63
#need to compare those two for identity
64
cb.process
65
cd.pythonCfgCode
66
67
68
def
listAll
(self):
69
for
wf
in
self.mrd.workFlows:
70
step=1
71
print
'---------------------'
72
print
'process workflow'
,wf.numId
73
print
74
while
self.
load
(float(wf.numId),step):
75
p=self.
getProcess
(float(wf.numId),step)
76
print
', '
.
join
(s.label()
for
s
in
p.schedule)
77
#print p.outputModules()
78
step+=1
79
MatrixToProcess.MatrixToProcess.getKey
def getKey
Definition:
MatrixToProcess.py:13
MatrixToProcess.MatrixToProcess.getConfig
def getConfig
Definition:
MatrixToProcess.py:51
MatrixToProcess.MatrixToProcess.strict
strict
Definition:
MatrixToProcess.py:12
MatrixToProcess.MatrixToProcess.__init__
def __init__
Definition:
MatrixToProcess.py:6
MatrixToProcess.MatrixToProcess.processes
processes
Definition:
MatrixToProcess.py:11
cmsDriverOptions.OptionsFromCommand
def OptionsFromCommand
Definition:
cmsDriverOptions.py:21
MatrixToProcess.MatrixToProcess.load
def load
Definition:
MatrixToProcess.py:24
MatrixReader
Definition:
MatrixReader.py:1
MatrixToProcess.MatrixToProcess.identityTest
def identityTest
Definition:
MatrixToProcess.py:57
ConfigBuilder
Definition:
ConfigBuilder.py:1
MatrixToProcess.MatrixToProcess.getProcess
def getProcess
Definition:
MatrixToProcess.py:16
MatrixToProcess.MatrixToProcess.mrd
mrd
Definition:
MatrixToProcess.py:8
MatrixToProcess.MatrixToProcess.listAll
def listAll
Definition:
MatrixToProcess.py:68
join
static std::string join(char **cmd)
Definition:
RemoteFile.cc:18
MatrixToProcess.MatrixToProcess
Definition:
MatrixToProcess.py:4
Exception
MatrixToProcess.MatrixToProcess.configBuilders
configBuilders
Definition:
MatrixToProcess.py:10
cmsDriverOptions
Generated for CMSSW Reference Manual by
1.8.5