示例#1
0
文件: utils.py 项目: chrisburr/manci
def initalise_dirac():
    for module in ['XRootD', 'LHCbDIRAC', 'DIRAC']:
        if module in sys.modules:
            print('WARNING: urban_baracle should be imported before', module)
            print('Access to DIRAC may not function correctly')

    try:
        from LHCbDIRAC.DataManagementSystem.Client.DMScript import Script  # NOQA
    except ImportError:
        raise ImportError('Unable to import LHCbDIRAC, try using "lb-run LHCbDIRAC/prod python -m manci ..."')

    argv, sys.argv = sys.argv, []
    Script.parseCommandLine()
    os.environ['XrdSecPROTOCOL'] = 'gsi,unix,krb5'
    sys.argv = argv
示例#2
0
#!/usr/bin/env python
########################################################################
# File :    dirac-bookkeeping-get-tck
# Author :  Zoltan Mathe
########################################################################
"""
  Returns list of TCKs for a run range, by default only if there is a FULL stream
"""
__RCSID__ = "$Id$"

from LHCbDIRAC.DataManagementSystem.Client.DMScript import Script

if __name__ == "__main__":
    Script.registerSwitch('', 'Runs=', 'Run range or list')
    Script.registerSwitch('', 'ByRange',
                          'List by range rather than by item value')
    Script.registerSwitch('', 'Force',
                          'Include runs even if no FULL stream is present')
    Script.registerSwitch('', 'DQFlag=', 'Specify the DQ flag (default: all)')
    Script.setUsageMessage('\n'.join([
        __doc__.split('\n')[1], 'Usage:',
        '  %s [option|cfgfile] ... ' % Script.scriptName
    ]))

    Script.parseCommandLine(ignoreErrors=True)

    from LHCbDIRAC.BookkeepingSystem.Client.ScriptExecutors import executeRunInfo
    executeRunInfo('Tck')
示例#3
0
#! /usr/bin/env python
"""
   Get statistical information on a dataset
"""

__RCSID__ = "$Id$"

from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script

if __name__ == "__main__":

    dmScript = DMScript()
    dmScript.registerBKSwitches()
    dmScript.registerFileSwitches()

    Script.registerSwitch('', 'ByStream', '   Get rejection for each stream')

    Script.setUsageMessage('\n'.join([
        __doc__.split('\n')[1],
        'Usage:',
        '  %s [option|cfgfile]' % Script.scriptName,
    ]))

    Script.parseCommandLine(ignoreErrors=False)

    from LHCbDIRAC.BookkeepingSystem.Client.ScriptExecutors import executeRejectionStats
    executeRejectionStats(dmScript)
示例#4
0
########################################################################
# File :    dirac-bookkeeping-file-path
# Author :  Zoltan Mathe
########################################################################
"""
  Return the BK path for the directories of a (list of) files
"""
__RCSID__ = "$Id$"
from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script

if __name__ == "__main__":
  dmScript = DMScript()
  dmScript.registerFileSwitches()
  Script.registerSwitch('', 'Full', '   Print out full BK dictionary (default: print out BK path)')
  Script.registerSwitch('', 'GroupBy=', '   Return a list of files per <metadata item>')
  Script.registerSwitch('', 'GroupByPath', '   Return a list of files per BK path')
  Script.registerSwitch('', 'GroupByProduction', '   Return a list of files per production')
  Script.registerSwitch('', 'Summary', '   Only give the number of files in each group (default: GroupByPath)')
  Script.registerSwitch('', 'List', '   Print a list of group keys')
  Script.registerSwitch('', 'IgnoreFileType', '   Ignore file type in path (useful for stripping)')
  Script.setUsageMessage('\n'.join([__doc__.split('\n')[1],
                                    'Usage:',
                                    '  %s [option|cfgfile] ... LFN|File' % Script.scriptName,
                                    'Arguments:',
                                    '  LFN:      Logical File Name',
                                    '  File:     Name of the file with a list of LFNs']))
  Script.parseCommandLine()

  from LHCbDIRAC.BookkeepingSystem.Client.ScriptExecutors import executeFilePath
  executeFilePath(dmScript)