Пример #1
0
def testPerfMon(jobOptName="PerfMonTests/test_perfMonSvc_noopalg.py",
                perfMonFileName="perfmon.noopalg.root",
                evtMax=50000):
    print("")
    print("#" * 80)
    print("## testing PerfMonSvc [%s]" % jobOptName)
    print("                  ==> [%s]... (%i)" % (perfMonFileName, evtMax))

    perfMonFileName = workDir(perfMonFileName)
    refPerfMonFileName = "ref." + os.path.basename(perfMonFileName)
    chkPerfMonFileName = "chk." + os.path.basename(perfMonFileName)
    outPerfMonFileName = "ana." + os.path.basename(perfMonFileName)

    refPerfMonFileName = refPerfMonFileName.replace(".root", ".pmon.gz")
    chkPerfMonFileName = chkPerfMonFileName.replace(".root", ".pmon.gz")

    ## create the reference file
    athena = ChapPy.Athena(jobOptions=[
        ChapPy.JobOptions(jobOptName),
        ChapPy.JobOptionsCmd("jobproperties.PerfMonFlags.OutputFile = '%s'" %
                             refPerfMonFileName)
    ],
                           checkLeak=False,
                           logFile=refPerfMonFileName + ".log")
    athena.EvtMax = evtMax
    sc = athena.run()
    if sc != 0:
        print("ERROR: could not create the 'ref' perfmon file !!")
        return ScOutput(sc, "ERROR")

    ## create the to-be-checked file
    athena = ChapPy.Athena(jobOptions=[
        ChapPy.JobOptions(jobOptName),
        ChapPy.JobOptionsCmd("jobproperties.PerfMonFlags.OutputFile = '%s'" %
                             chkPerfMonFileName)
    ],
                           checkLeak=False,
                           logFile=chkPerfMonFileName + ".log")
    athena.EvtMax = evtMax
    sc = athena.run()
    if sc != 0:
        print("ERROR: could not create the 'chk' perfmon file !!")
        return ScOutput(sc, "ERROR")

    #outPerfMonFileName = "ana." + os.path.basename( perfMonFileName )
    print(" :::running [perfmon.py]...")
    cmd = "perfmon.py %s %s -o %s" % \
          ( chkPerfMonFileName, refPerfMonFileName, outPerfMonFileName )
    sc, out = subprocess.getstatusoutput(cmd)
    if sc != 0:
        print("## Problem while doing [perfmon] !!")
        print(out)
        out = "ERROR"
        return ScOutput(sc, out)

    out = "OK"
    print("## [DONE]")
    return ScOutput(sc, out)
Пример #2
0
def testPerfMon(jobOptName="PerfMonTests/test_perfMonSvc_noopalg.py",
                perfMonFileName="perfmon.noopalg.pmon.gz",
                evtMax=50000):
    print ""
    print "#" * 80
    print "## testing PerfMonSvc [%s]" % jobOptName
    print "                  ==> [%s]... (%i)" % (perfMonFileName, evtMax)

    refPerfMonFileName = "ref." + os.path.basename(perfMonFileName)
    chkPerfMonFileName = "chk." + os.path.basename(perfMonFileName)
    outPerfMonFileName = "ana." + os.path.basename(perfMonFileName)

    ## create the reference file
    athena = ChapPy.Athena(jobOptions=[ChapPy.JobOptions(jobOptName)],
                           checkLeak=False,
                           logFile=refPerfMonFileName + ".log")
    athena.EvtMax = evtMax
    athena.run()
    os.rename("perfmon.pmon.gz", refPerfMonFileName)

    ## create the to-be-checked file
    athena = ChapPy.Athena(jobOptions=[ChapPy.JobOptions(jobOptName)],
                           checkLeak=False,
                           logFile=chkPerfMonFileName + ".log")
    athena.EvtMax = evtMax
    athena.run()
    os.rename("perfmon.pmon.gz", chkPerfMonFileName)

    print " :::running [perfmon.py]..."
    cmd = "perfmon.py -o %s %s %s --labels 'chk,ref'" % \
          ( outPerfMonFileName, chkPerfMonFileName, refPerfMonFileName )
    sc, out = commands.getstatusoutput(cmd)
    if sc != 0:
        print "## Problem while doing [perfmon] !!"
        print out
    else:
        print "## [DONE]"

    return sc
Пример #3
0
    def run( self ):

        self.data = []
        self.chronoStats= []
        self.athena.jobOptions += [
            ChapPy.JobOptions( "TestTools/IoAuditor_fragment.py" ),
            ChapPy.JobOptionsCmd( "svcMgr.ChronoStatSvc.AsciiStatsOutputFile = \"%s\"" % self.ioStatsFileName )
            ]
        for i in range(self.nTimes):
            self.athena.logFile = open( "%s.%s" % (self.logFileName,i), "w" )
            iStart = getResources()
            out = self.athena.run()
            self.data.append( getResources() - iStart )
            self.chronoStats.append( ChronoStatReport(self.ioStatsFileName) )
            pass

        return
Пример #4
0
print("## testing symlinks for TruthParticleContainer...")
bench = BenchSequence("Symlinks for TruthParticleContainer")

print("## installing reference files...")
installRefFiles([
    "mc.aod.symlinks.ref",
    "mc.aod.pysymlinks.ref",
])

evtMax = 5

###-----------------------------------------------------
print("## Testing [writing]...")
jobOptions = [
    ChapPy.JobOptionsCmd("OUTPUT=\"%s\"" % workDir("mc.aod.symlinks.pool")),
    ChapPy.JobOptions("McParticleTests/symlinkTest_mcAod_jobOptions.py"),
]

athena = ChapPy.Athena(jobOptions=jobOptions,
                       logFile=workDir("mc.aod.symlinks.pool.log"),
                       checkLeak=False)
athena.EvtMax = evtMax
athena.run()

###-----------------------------------------------------
print("\n")
print("#" * 80)
bench += doPostCheck("McAod symlinks", workDir("mc.aod.symlinks.ref"),
                     workDir("mc.aod.symlinks.pool.log"),
                     "grep \"^McAodSymLinkTests\"")
Пример #5
0
print "## testing slimming exercize..."
print "## installing reference files..."
installRefFiles([
    "AthExThinning_makeData.ref",
    "pyWriteSlimmedData.ref",
    "ReadSlimmedData.ref",
    "ReadNonSlimmedData.ref",
])

###-----------------------------------------------------
print "\n"
print "#" * 80
print "## Preparing input data..."
jobOptions = [
    ChapPy.JobOptionsCmd("OUTPUT=\"%s\"" % workDir("my.pydata.toslim.pool")),
    ChapPy.JobOptions("AthExThinning/AthExThinning_makeData.py"),
]

athena = ChapPy.Athena(jobOptions=jobOptions,
                       logFile=workDir("my.pydata.toslim.pool.log"),
                       checkLeak=False)
athena.EvtMax = EVTMAX
athena.run()

###-----------------------------------------------------
print "\n"
print "#" * 80
sc, out = doValidation("Input Data", workDir("AthExThinning_makeData.ref"),
                       workDir("my.pydata.toslim.pool.log"),
                       "grep '^CreateData' | grep INFO ")
if sc != 0:
Пример #6
0
mcAodFile    = workDir("mc.aod.%s.pool"%uuid)

print "#"*80
print "## testing TruthParticleContainer I/O..."
print "## Job uuid:",uuid
benchSequence = BenchSequence( "TruthParticleContainer I/O" )

###-----------------------------------------------------
if os.path.exists(genEventFile):
    print "## Re-using input data..."
else:
    print "## Preparing input data..."
    jobOptions = [
        ChapPy.JobOptionsCmd( "OUTPUT=\"%s\"" % genEventFile ),
        ChapPy.JobOptionsCmd( "DUMP=False" ),
        ChapPy.JobOptions( "McParticleTests/iotest_WriteGenEvent_jobOptions.py" ),
        ]
    athena = ChapPy.Athena( jobOptions = jobOptions,
                            checkLeak  = False )
    athena.EvtMax = EVTMAX
    athena.run()
    pass

###-----------------------------------------------------
print "\n\n"
print "#"*80
print "## Testing [writing]..."
jobOptions = [
    ChapPy.JobOptionsCmd( "INPUT=[\"%s\"]" % genEventFile ),
    ChapPy.JobOptionsCmd( "OUTPUT=\"%s\""  % mcAodFile ),
    ChapPy.JobOptionsCmd( "DUMP=False" ),
Пример #7
0
print "## testing Thinning exercize..."
print "## installing reference files..."
installRefFiles([
    "AthExThinning_makeData.ref",
    "pyWriteThinnedData.ref",
    "ReadThinnedData.ref",
    "ReadNonThinnedData.ref",
])

###-----------------------------------------------------
print "\n"
print "#" * 80
print "## Preparing input data..."
jobOptions = [
    ChapPy.JobOptionsCmd("OUTPUT=\"%s\"" % workDir("my.pydata.tothin.pool")),
    ChapPy.JobOptions("AthExThinning/AthExThinning_makeData.py"),
]

athena = ChapPy.Athena(jobOptions=jobOptions,
                       logFile=workDir("my.pydata.tothin.pool.log"),
                       checkLeak=False)
athena.EvtMax = EVTMAX
athena.run()

###-----------------------------------------------------
print "\n"
print "#" * 80
sc, out = doValidation("Input Data", workDir("AthExThinning_makeData.ref"),
                       workDir("my.pydata.tothin.pool.log"),
                       "grep '^CreateData' | grep INFO ")
if sc != 0:
###-----------------------------------------------------
## For compatibility with ATN tests
from TestTools.iobench import workDir

###-----------------------------------------------------
## Little helper to validate output of jobs
from TestTools.iobench import ScOutput
from TestTools.iobench import BenchSequence

print "#" * 80
print "## StoreGate test... [producer/consumer-DataPool-bench]"
print "#" * 80
print ":::   No DataPool ",
athena = ChapPy.Athena(jobOptions=[
    ChapPy.JobOptionsCmd("SGDATAPOOL=False"),
    ChapPy.JobOptions("StoreGateTests/test_sgProducerConsumer_jobOptions.py"),
    ChapPy.JobOptionsCmd("jp.PerfMonFlags.OutputFile = 'nodatapool.pmon.gz'"),
])
athena.EvtMax = 100
sc = athena.run()
if sc != 0:
    print "ERROR"
    sys.exit(sc)

print "::: With DataPool ",
athena = ChapPy.Athena(jobOptions=[
    ChapPy.JobOptionsCmd("SGDATAPOOL=True"),
    ChapPy.JobOptions("StoreGateTests/test_sgProducerConsumer_jobOptions.py"),
    ChapPy.JobOptionsCmd(
        "jp.PerfMonFlags.OutputFile = 'withdatapool.pmon.gz'"),
])
Пример #9
0
# @purpose: unit test file for the iobench module
# @author:  Sebastien Binet <*****@*****.**>
# @date:    July 2006

import user
import sys
from TestTools import iobench
from AthenaCommon import ChapPy

if __name__ == "__main__":
    print "#" * 80
    print "## testing iobench ..."

    jobOptions = [
        ChapPy.JobOptionsCmd("OUTPUT=\"/tmp/slimmed.aod.pool\""),
        ChapPy.JobOptions("McParticleAlgs/test_WriteMcAod_jobOptions.py")
    ]
    athena = ChapPy.Athena(jobOptions=jobOptions, checkLeak=True)
    athena.EvtMax = 100

    bench = iobench.AthBench(athena, nTimes=10)
    print "## bench:"
    print bench.athena
    bench.run()

    bench.ioStats(["GEN_AOD", "GEN_EVENT", "SpclMC"], "w")
    bench.save("iobench-%ievts.log" % athena.EvtMax)
    bench.stats()

    print ""
    print "## Bye."