Skip to content
Snippets Groups Projects
Commit f531e432 authored by Nils Krumnack's avatar Nils Krumnack
Browse files

allow python configurables to add themselves to EventLoop job objects

The ultimate goal here is to have the python configurable no longer
inherit from the C++ object, and instead create the C++ object only at
the moment when it is needed, instead of having it as a base class and
performing all updates simultaneously to the python object and the C++
object (to keep them in sync).  However, for now it mostly adds an
alternate way of adding algorithms to jobs, to actually make the more
fundamental change to the configurables would require all users to
update to the new formalism of adding algorithms to jobs.

This also allows additional configurable objects to be used, e.g. I
now treat algorithm sequences and algorithms the same.

This could potentially also be used to change the target or mechanism
of configuration at some point, e.g. to push this into an intermediate
JSON file, but that's not an immediate goal.
parent 4a6a0176
No related branches found
No related tags found
No related merge requests found
Showing
with 42 additions and 45 deletions
......@@ -54,10 +54,8 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeEventAlgorithmsSequence
algSeq = makeEventAlgorithmsSequence (dataType)
print algSeq # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
print( algSeq ) # For debugging
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -53,10 +53,8 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeGeneratorAlgorithmsSequence
algSeq = makeGeneratorAlgorithmsSequence (dataType)
print algSeq # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
print( algSeq ) # For debugging
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -54,11 +54,8 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
from AsgAnalysisAlgorithms.AsgAnalysisAlgorithmsTest import makeOverlapSequence
algSeq = makeOverlapSequence (dataType)
print algSeq # For debugging
for alg in algSeq :
job.algsAdd( alg )
pass
print( algSeq ) # For debugging
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -62,10 +62,8 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
from EgammaAnalysisAlgorithms.EgammaAnalysisAlgorithmsTest import makeSequence
algSeq = makeSequence (dataType, not useDNNeID)
print algSeq # For debugging
for alg in algSeq :
job.algsAdd( alg )
pass
print (algSeq) # For debugging
algSeq.addSelfToJob( job )
# Find the right output directory:
submitDir = options.submission_dir
......
......@@ -59,10 +59,8 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
from FTagAnalysisAlgorithms.FTagAnalysisAlgorithmsTest import makeSequence
algSeq = makeSequence (dataType)
print algSeq # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
print (algSeq) # For debugging
algSeq.addSelfToJob( job )
# Find the right output directory:
submitDir = options.submission_dir
......
......@@ -56,10 +56,8 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
from JetAnalysisAlgorithms.JetAnalysisAlgorithmsTest import makeSequence
algSeq = makeSequence (dataType, jetContainer)
print algSeq # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
print (algSeq) # For debugging
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -56,10 +56,8 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
from JetAnalysisAlgorithms.JetAnalysisAlgorithmsTest import makeSequence
algSeq = makeSequence (dataType, jetContainer)
print algSeq # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
print (algSeq) # For debugging
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -61,10 +61,8 @@ job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
from MetAnalysisAlgorithms.MetAnalysisAlgorithmsTest import makeSequence
algSeq = makeSequence (dataType)
print algSeq # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
print (algSeq) # For debugging
algSeq.addSelfToJob( job )
# Find the right output directory:
submitDir = options.submission_dir
......
......@@ -59,10 +59,8 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
from MuonAnalysisAlgorithms.MuonAnalysisAlgorithmsTest import makeSequence
algSeq = makeSequence (dataType)
print algSeq # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
print( algSeq ) # For debugging
algSeq.addSelfToJob( job )
# Make sure that both the ntuple and the xAOD dumper have a stream to write to.
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -58,10 +58,8 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 500 )
from TauAnalysisAlgorithms.TauAnalysisAlgorithmsTest import makeSequence
algSeq = makeSequence (dataType)
print algSeq # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
print( algSeq ) # For debugging
algSeq.addSelfToJob( job )
# Find the right output directory:
submitDir = options.submission_dir
......
......@@ -55,10 +55,8 @@ job.options().setString( ROOT.EL.Job.optSubmitDirMode, "unique" )
from TriggerAnalysisAlgorithms.TriggerAnalysisAlgorithmsTest import makeSequence
algSeq = makeSequence (dataType)
print algSeq # For debugging
for alg in algSeq:
job.algsAdd( alg )
pass
print(algSeq) # For debugging
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -54,6 +54,17 @@ except ImportError:
return self.__iadd__( algOrSeq, index = index )
def addSelfToJob( self, job ):
"""add a copy of this config to the EventLoop job object
Keyword arguments:
job -- The job object to add ourself to
"""
for alg in self:
alg.addSelfToJob (job)
pass
pass
def __getitem__( self, index ):
"""Return one algorithm/sequence from the sequence by index
......
......@@ -80,6 +80,15 @@ class PythonConfig( ROOT.EL.PythonConfigBase ):
return self.type()
def addSelfToJob( self, job ):
"""add a copy of this config to the EventLoop job object
Keyword arguments:
job -- The job object to add ourself to
"""
job.algsAdd( self )
pass
def __getattr__( self, name ):
"""Get a previously set property value from the configuration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment