Skip to content
Snippets Groups Projects
Select Git revision
  • 048b02b1f047d77f318aa00cff81f6a79b3db297
  • master default
  • main-ATDAQPPES-18-19
  • main-ATDAQPPES-18-18
  • main-ATDAQPPES-18-17
  • main-ATDAQPPES-18-16
  • main-ATDAQPPES-18-15
  • main-ATDAQPPES-18-13-1
  • main-ATDAQPPES-18-13
  • main-ATDAQPPES-18-14
  • main-ATDAQPPES-18-12
  • main-ATDAQPPES-18-11
  • main-ATDAQPPES-18-10
  • main-ATDAQPPES-18-09
  • main-ATDAQPPES-18-08
  • main-ATDAQPPES-18-07
  • main-ATDAQPPES-18-05
  • main-ATDAQPPES-18-04
  • main-ATDAQPPES-18-03
  • main-ATDAQPPES-18-02
  • main-ATDAQPPES-18-01
  • main-ATDAQPPES-18-00
  • nightly/master/2018-12-19T2001
  • nightly/master/2018-12-19T2143
  • nightly/master/2018-12-19T2258
  • nightly/master/2018-12-19T2259
  • nightly/21.2/2018-12-20T0018
  • nightly/21.2/2018-12-20T0324
  • nightly/21.2/2018-12-20T0332
  • nightly/21.6/2018-12-19T2218
  • nightly/21.0/2018-12-19T1952
  • nightly/21.0/2018-12-19T2121
  • nightly/21.0/2018-12-19T2159
  • nightly/21.0/2018-12-19T2250
  • nightly/21.2/2018-12-19T0018
  • nightly/21.2/2018-12-19T0324
  • nightly/21.2/2018-12-19T0331
  • nightly/21.2/2018-12-19T0333
  • nightly/master/2018-12-18T2000
  • nightly/master/2018-12-18T2143
  • nightly/master/2018-12-18T2257
  • nightly/master/2018-12-18T2351
42 results

trfFileValidationFunctions.py

Blame
  • Forked from atlas / athena
    118465 commits behind the upstream repository.
    Pascal Rene Baehr's avatar
    Pascal Rene Baehr authored and Walter Lampl committed
    Futurize stage 2 changes for test files, scripts and shared files. Also various changes to comparisons.
    048b02b1
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    trfFileValidationFunctions.py 3.03 KiB
    
    # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
    
    ## @package PyJobTransforms.trfFileValidationFunctions
    # @brief Transform file validation functions
    # @author atlas-comp-transforms-dev@cern.ch
    # @version $Id: trfUtils.py 578615 2014-01-15 21:22:05Z wbreaden $
    
    import logging
    msg = logging.getLogger(__name__)
    
    import PyJobTransforms.trfExceptions as trfExceptions
    
    ## @brief Integrity function for file class argPOOLFile, argHITSFile, argRDOFile and argEVNTFile
    def returnIntegrityOfPOOLFile(fname):
        from PyJobTransforms.trfValidateRootFile import checkFile
        rc = checkFile(fileName = fname, type = 'event', requireTree = True)
        if rc == 0:
            return (True, "integrity of {fileName} good".format(fileName = str(fname)))
        else:
            return (False, "integrity of {fileName} bad: return code: {integrityStatus}".format(fileName = str(fname), integrityStatus = rc))
    
    ## @brief Integrity function for file class argNTUPFile
    def returnIntegrityOfNTUPFile(fname):
        from PyJobTransforms.trfValidateRootFile import checkFile
        rc = checkFile(fileName = fname, type = 'basket', requireTree = False)
        if rc == 0:
            return (True, "integrity of {fileName} good".format(fileName = str(fname)))
        else:
            return (False, "integrity of {fileName} bad: return code: {integrityStatus}".format(fileName = str(fname), integrityStatus = rc))
    
    ## @brief Integrity function for file class argBSFile
    def returnIntegrityOfBSFile(fname):
        try:
            from PyJobTransforms.trfUtils import call
            rc = call(["AtlListBSEvents", "-c", fname],
                logger = msg,
                message = "Report by AtlListBSEvents: ",
                timeout = None
            )
        except trfExceptions.TransformTimeoutException:
            return False
        if rc == 0:
            return (True, "integrity of {fileName} good".format(fileName = str(fname)))
        else:
            return (False, "integrity of {fileName} bad: return code: {integrityStatus}".format(fileName = str(fname), integrityStatus = rc))
    
    ### @brief Integrity function for file class argTAGFile
    def returnIntegrityOfTAGFile(fname):
        from PyJobTransforms.trfFileUtils import AthenaLiteFileInfo
        dictionaryOfAthenaFileInfo = AthenaLiteFileInfo(fname, "TAG", retrieveKeys = ['nentries',])
        msg.debug("dictionary of Athena file information: {a}".format(a = dictionaryOfAthenaFileInfo))
        eventCount = dictionaryOfAthenaFileInfo[fname]['nentries']
        if eventCount is None:
            return (False, "integrity of {fileName} bad: got a bad event count in {fileName}: {eventCount}".format(fileName = str(fname), eventCount = eventCount))
        else:
            return (True, "integrity of {fileName} good".format(fileName = str(fname)))
    
    ## @brief Integrity function for file class argHISTFile
    def returnIntegrityOfHISTFile(fname):
        rc = 0 # (default behaviour)
        if rc == 0:
            return (True, "integrity of {fileName} good".format(fileName = str(fname)))
        else:
            return (False, "integrity of {fileName} bad: return code: {integrityStatus}".format(fileName = str(fname), integrityStatus = rc))