Commit 3e89c615 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 7d43d2f8
......@@ -59,9 +59,7 @@ 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
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -53,9 +53,7 @@ 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
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -54,9 +54,7 @@ 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
algSeq.addSelfToJob( job )
# Set up an output file for the job:
......
......@@ -62,9 +62,7 @@ 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
algSeq.addSelfToJob( job )
# Find the right output directory:
submitDir = options.submission_dir
......
......@@ -54,9 +54,7 @@ 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
algSeq.addSelfToJob( job )
# Find the right output directory:
submitDir = options.submission_dir
......
......@@ -56,9 +56,7 @@ 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
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -56,9 +56,7 @@ 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
algSeq.addSelfToJob( job )
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
......
......@@ -61,9 +61,7 @@ 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
algSeq.addSelfToJob( job )
# Find the right output directory:
submitDir = options.submission_dir
......
......@@ -62,9 +62,7 @@ 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
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' ) )
......
......@@ -64,9 +64,7 @@ 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
algSeq.addSelfToJob( job )
# Find the right output directory:
submitDir = options.submission_dir
......
......@@ -60,9 +60,7 @@ 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
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment