Esempio n. 1
0
#!/usr/bin/env python
########################################################################
# 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)
Esempio n. 2
0
#!/usr/bin/env python
'''
    Check if all files have a replica in a certain (set of) SE )Tier1-Archive default)
    List the files that don't have a replica in the specified SE (group)
'''
__RCSID__ = "$Id$"


if __name__ == '__main__':

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

  Script.registerSwitch('', 'FixIt', '   Take action to fix the catalogs')
  Script.setUsageMessage('\n'.join([__doc__,
                                    'Usage:',
                                    '  %s [option|cfgfile] [values]' % Script.scriptName, ]))
  dmScript = DMScript()
  dmScript.registerDMSwitches()  # Directory
  Script.parseCommandLine(ignoreErrors=True)
  fixIt = False
  for opt, val in Script.getUnprocessedSwitches():
    if opt == 'FixIt':
      fixIt = True

  # imports
  from DIRAC import gLogger
  from LHCbDIRAC.DataManagementSystem.Client.ConsistencyChecks import ConsistencyChecks
  cc = ConsistencyChecks()
  cc.directories = dmScript.getOption('Directory', [])
  cc.lfns = dmScript.getOption('LFNs', []) + [lfn for arg in Script.getPositionalArgs() for lfn in arg.split(',')]
Get the list of all the user files.
"""
__RCSID__ = "$Id$"

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

if __name__ == "__main__":

    days = 0
    months = 0
    years = 0
    depth = 1
    wildcard = '*'
    dmScript = DMScript()
    dmScript.registerNamespaceSwitches()
    Script.registerSwitch("", "Days=",
                          "Match files older than number of days [%s]" % days)
    Script.registerSwitch(
        "", "Months=", "Match files older than number of months [%s]" % months)
    Script.registerSwitch(
        "", "Years=", "Match files older than number of years [%s]" % years)
    Script.registerSwitch("", "Wildcard=",
                          "Wildcard for matching filenames [%s]" % wildcard)
    Script.registerSwitch('', 'Output', 'Write list to an output file')
    Script.registerSwitch("", "EmptyDirs",
                          "Create a list of empty directories")
    Script.registerSwitch(
        "", "Depth=",
        "Depth to which recursively browse (default = %d)" % depth)
    Script.registerSwitch("r", "Recursive", "Set depth to infinite")
    Script.registerSwitch('', 'NoDirectories',
                          'Only print out only files, not subdirectories')
Esempio n. 4
0
      seList += siteSEs
  return seList


if __name__ == '__main__':

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

  Script.setUsageMessage('\n'.join([__doc__,
                                    'Usage:',
                                    '  %s [option|cfgfile] [values]' % Script.scriptName, ]))
  dmScript = DMScript()
  dmScript.registerDMSwitches()
  maxFiles = 20
  Script.registerSwitch('', 'FixIt', '   Take action to fix the catalogs and storage')
  Script.registerSwitch('', 'Replace', '   Replace bad or missing replicas (default=False)')
  Script.registerSwitch('', 'NoBK', '   Do not check with BK')
  Script.registerSwitch('', 'Verbose', '   Set logging mode to INFO')
  Script.registerSwitch('', 'MaxFiles=', '   Set maximum number of files to be printed (default %d)' % maxFiles)
  Script.parseCommandLine(ignoreErrors=True)

  from DIRAC import gLogger

  fixIt = False
  bkCheck = True
  replace = False
  verbose = False
  for switch in Script.getUnprocessedSwitches():
    if switch[0] == 'FixIt':
      fixIt = True
Esempio n. 5
0
#!/usr/bin/env python
########################################################################
# File :    dirac-bookkeeping-get-file-descendants
# Author :  Zoltan Mathe
########################################################################
"""
  Returns descendants for a (list of) LFN(s)
"""
__RCSID__ = "$Id$"

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

if __name__ == "__main__":
    dmScript = DMScript()
    dmScript.registerFileSwitches()
    Script.registerSwitch('', 'All',
                          'Do not restrict to descendants with replicas')
    Script.registerSwitch('', 'Full',
                          'Get full metadata information on descendants')
    level = 1
    Script.registerSwitch('', 'Depth=',
                          'Number of processing levels (default:%d)' % level)
    Script.registerSwitch(
        '', 'Production=',
        'Restrict to descendants in a given production (at any depth)')
    Script.setUsageMessage('\n'.join([
        __doc__.split('\n')[1], 'Usage:',
        '  %s [option|cfgfile] ... [LFN|File] [Depth]' % Script.scriptName,
        'Arguments:', '  LFN:      Logical File Name',
        '  File:     Name of the file with a list of LFNs',
        '  Depth:    Number of levels to search (default: %d)' % level
    ]))
Esempio n. 6
0
#! /usr/bin/env python
"""
   Fix the luminosity of all descendants of a set of RAW files, if hte run is Finished
"""

__RCSID__ = "$Id$"

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

if __name__ == "__main__":

    dmScript = DMScript()
    dmScript.registerBKSwitches()

    Script.registerSwitch('', 'DoIt', '   Fix the BK database (default No)')
    Script.registerSwitch(
        '', 'Force',
        '   Force checking all descendants and not only those of files with bad lumi (default No)'
    )
    Script.setUsageMessage('\n'.join([
        __doc__.split('\n')[1],
        'Usage:',
        '  %s [option|cfgfile]' % Script.scriptName,
    ]))

    Script.addDefaultOptionValue('LogLevel', 'error')
    Script.parseCommandLine(ignoreErrors=False)

    from LHCbDIRAC.BookkeepingSystem.Client.ScriptExecutors import executeFixLuminosity
    executeFixLuminosity(dmScript)
#!/usr/bin/env python
"""
  Retrieve an access URL for an LFN replica given a valid DIRAC SE.
"""

__RCSID__ = "$Id$"

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

if __name__ == "__main__":

    dmScript = DMScript()
    dmScript.registerFileSwitches()
    dmScript.registerSiteSwitches()
    Script.registerSwitch(
        '', 'Protocol=',
        '   Define the protocol for which a tURL is requested (default:root)')
    Script.setUsageMessage('\n'.join(
        __doc__.split('\n') + [
            'Usage:',
            '  %s [option|cfgfile] ... [LFN[,LFN2[,LFN3...]]] SE[,SE2...]' %
            Script.scriptName, 'Arguments:',
            '  LFN:      Logical File Name or file containing LFNs',
            '  SE:       Valid DIRAC SE'
        ]))
    Script.parseCommandLine(ignoreErrors=True)

    from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeAccessURL
    from DIRAC import exit
    exit(executeAccessURL(dmScript))
#!/usr/bin/env python
########################################################################
# File :    dirac-bookkeeping-get-conditions
# Author :  Zoltan Mathe
########################################################################
"""
  Returns list of Conditions 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.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('DataTakingDescription')
Esempio n. 9
0
# Author :  Ph. Charpentier
########################################################################
"""
  Gets the metadata of a (list of) LHCb LFNs/PFNs given a valid DIRAC SE (or for all replicas)
  Only the LFN contained in the PFN is considered, unlike the DIRAC similar script
"""
__RCSID__ = "$Id$"

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

if __name__ == "__main__":

    dmScript = DMScript()
    dmScript.registerFileSwitches()
    dmScript.registerSiteSwitches()
    Script.registerSwitch('', 'Check',
                          '   Checks the PFN metadata vs LFN metadata')
    Script.registerSwitch(
        '', 'Exists',
        '   Only reports if the file exists (and checks the checksum)')
    Script.registerSwitch('', 'Summary',
                          '   Only prints a summary on existing files')
    Script.setUsageMessage('\n'.join([
        __doc__, 'Usage:',
        '  %s [option|cfgfile] ... [URL[,URL2[,URL3...]]] SE[ SE2...]' %
        Script.scriptName, 'Arguments:',
        '  URL:      Logical/Physical File Name or file containing URLs',
        '  SE:       Valid DIRAC SE'
    ]))
    Script.parseCommandLine(ignoreErrors=True)

    from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executePfnMetadata
Esempio n. 10
0
#!/usr/bin/env python
"""
 List all BK paths matching a wildcard path ('...' is the wildcard character, or '*' but enclose with quotes)
"""

__RCSID__ = "$Id$"

from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script, ProgressBar
from DIRAC import gLogger, exit

if __name__ == "__main__":

    Script.registerSwitch("B:", "BKQuery=", "   Bookkeeping query path")
    Script.setUsageMessage('\n'.join([
        __doc__.split('\n')[1],
        'Usage:',
        '  %s [option|cfgfile] ...' % Script.scriptName,
    ]))

    Script.parseCommandLine(ignoreErrors=True)

    bkPaths = []
    for opt, val in Script.getUnprocessedSwitches():
        if opt == 'BKQuery':
            bkPaths = val.split(',')
    if not bkPaths:
        gLogger.error('No BK path provided...')
        Script.showHelp()
        exit(1)

    from LHCbDIRAC.BookkeepingSystem.Client.BKQuery import getProcessingPasses, BKQuery
"""
   Set the visibility flag to a dataset
"""

__RCSID__ = "$Id$"

from DIRAC import exit as dExit, gLogger
from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script

if __name__ == "__main__":

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

    Script.registerSwitch('', 'List', '   Print out the list of LFNs')
    Script.setUsageMessage('\n'.join([
        __doc__.split('\n')[1],
        'Usage:',
        '  %s [option|cfgfile]' % Script.scriptName,
    ]))

    Script.parseCommandLine(ignoreErrors=False)
    dumpList = False
    for switch in Script.getUnprocessedSwitches():
        if switch[0] == 'List':
            dumpList = True

    bkQuery = dmScript.getBKQuery()
    lfns = dmScript.getOption('LFNs', [])
    if not bkQuery and not lfns:
#!/usr/bin/env python
"""
Remove replicas of a (list of) LFNs at a list of sites. It is possible to request a minimum of remaining replicas
"""

__RCSID__ = "$Id$"

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

if __name__ == "__main__":
    dmScript = DMScript()
    dmScript.registerFileSwitches()
    dmScript.registerSiteSwitches()

    Script.registerSwitch(
        "n", "NoFC",
        " use this option to force the removal from storage of replicas not in FC"
    )
    Script.registerSwitch(
        '', 'ReduceReplicas=',
        '  specify the number of replicas you want to keep (default SE: Tier1-USER)'
    )
    Script.registerSwitch(
        "", "Force",
        " use this option for force the removal of replicas even if last one")
    Script.setUsageMessage('\n'.join(
        __doc__.split('\n') + [
            'Usage:',
            '  %s [option|cfgfile] ... [LFN[,LFN2[,LFN3...]]] SE[,SE2...]' %
            Script.scriptName, 'Arguments:',
            '  LFN:      Logical File Name or file containing LFNs',
            '  SE:       Valid DIRAC SE'
#!/usr/bin/env python
########################################################################
# File :    dirac-bookkeeping-get-run-ranges
# Author :  Zoltan Mathe
########################################################################
"""
  Returns run ranges, split by conditions and by run gaps or time interval between them
"""
__RCSID__ = "$Id$"

from LHCbDIRAC.DataManagementSystem.Client.DMScript import Script

if __name__ == "__main__":
    Script.registerSwitch('', 'Activity=',
                          'Specify the BK activity (e.g. Collision15)')
    Script.registerSwitch(
        '', 'Runs=',
        'Run range or list (can be used with --Activity to reduce the run range)'
    )
    Script.registerSwitch(
        '', 'Fast',
        'Include runs even if no FULL stream is present (much faster)')
    Script.registerSwitch('', 'DQFlag=', 'Specify the DQ flag (default: all)')
    Script.registerSwitch('', 'RunGap=',
                          'Gap between run ranges, in number of runs')
    Script.registerSwitch('', 'TimeGap=',
                          'Gap between run ranges, in number of days')
    Script.setUsageMessage('\n'.join([
        __doc__.split('\n')[1], 'Usage:',
        '  %s [option|cfgfile] ... ' % Script.scriptName
    ]))
Esempio n. 14
0
########################################################################
# File :    dirac-wms-job-parameters
# Author :  Philippe Charpentier
########################################################################
"""
  Retrieve parameters associated to the given DIRAC job
"""

# FIXME: this is almost the same of vanilla DIRAC script that has the same name

__RCSID__ = "$Id$"

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

Script.registerSwitch('', 'Parameters=',
                      '   If present, print out only those parameters')
Script.setUsageMessage('\n'.join([
    __doc__.split('\n')[1], 'Usage:',
    '  %s [option|cfgfile] ... JobID ...' % Script.scriptName, 'Arguments:',
    '  JobID:    DIRAC Job ID'
]))
Script.parseCommandLine(ignoreErrors=True)
args = Script.getPositionalArgs()

if len(args) < 1:
    Script.showHelp()
parameters = None
for switch in Script.getUnprocessedSwitches():
    if switch[0] == 'Parameters':
        parameters = switch[1].split(',')
#! /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( '', 'TriggerRate', '   For RAW files, returns the trigger rate' )
  Script.registerSwitch( '', 'ListRuns', '   Give a list of runs (to be used with --Trigger)' )
  Script.registerSwitch( '', 'ListFills', '   Give a list of fills (to be used with --Trigger)' )
  Script.setUsageMessage( '\n'.join( [ __doc__.split( '\n' )[1],
                                       'Usage:',
                                       '  %s [option|cfgfile]' % Script.scriptName, ] ) )

  Script.parseCommandLine( ignoreErrors = False )

  from LHCbDIRAC.BookkeepingSystem.Client.ScriptExecutors import executeGetStats
  executeGetStats( dmScript )
Esempio n. 16
0
# File :    dirac-dms-pfn-metadata.py
# Author :  Ph. Charpentier
########################################################################
"""
  Check existence of a (list of) LHCb LFNs/PFNs given a valid DIRAC SE (or for all replicas)
  Only the LFN contained in the PFN is considered, unlike the DIRAC similar script
"""
__RCSID__ = "$Id$"

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

if __name__ == "__main__":

    dmScript = DMScript()
    dmScript.registerFileSwitches()
    dmScript.registerSiteSwitches()
    Script.registerSwitch('', 'Summary',
                          '   Only prints a summary on existing files')
    Script.setUsageMessage('\n'.join([
        __doc__, 'Usage:',
        '  %s [option|cfgfile] ... [URL[,URL2[,URL3...]]] SE[ SE2...]' %
        Script.scriptName, 'Arguments:',
        '  URL:      Logical/Physical File Name or file containing URLs',
        '  SE:       Valid DIRAC SE'
    ]))
    Script.parseCommandLine(ignoreErrors=True)

    from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executePfnMetadata
    from DIRAC import exit
    exit(executePfnMetadata(dmScript, check=True, exists=True))
Esempio n. 17
0
########################################################################
# File :    dirac-bookkeeping-get-file-ancestors
# Author :  Zoltan Mathe
########################################################################
"""
  returns ancestors for a (list of) LFN(s) 
"""
__RCSID__ = "$Id$"

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

if __name__ == "__main__":
    dmScript = DMScript()
    dmScript.registerFileSwitches()
    level = 1
    Script.registerSwitch('', 'All',
                          'Do not restrict to ancestors with replicas')
    Script.registerSwitch('', 'Full',
                          'Get full metadata information on ancestors')
    Script.registerSwitch('', 'Depth=',
                          'Number of processing levels (default:%d)' % level)
    Script.setUsageMessage('\n'.join([
        __doc__.split('\n')[1], 'Usage:',
        '  %s [option|cfgfile] ... [LFN|File] [Level]' % Script.scriptName,
        'Arguments:', '  LFN:      Logical File Name',
        '  File:     Name of the file with a list of LFNs',
        '  Level:    Number of levels to search (default: %d)' % level
    ]))

    Script.parseCommandLine(ignoreErrors=True)

    from LHCbDIRAC.BookkeepingSystem.Client.ScriptExecutors import executeFileAncestors
#!/usr/bin/env python
########################################################################
# File :    dirac-bookkeeping-get-files.py
# Author :  Zoltan Mathe
########################################################################
"""
  Retrieve files of a BK query
"""
__RCSID__ = "$Id$"
from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script

dmScript = DMScript()
dmScript.registerBKSwitches()
Script.registerSwitch('', 'File=', '   Provide a list of BK paths')
Script.registerSwitch('', 'Term',
                      '   Provide the list of BK paths from terminal')
Script.registerSwitch('', 'Output=',
                      '  Specify a file that will contain the list of files')
Script.registerSwitch('', 'OptionsFile=', '   Create a Gaudi options file')
maxFiles = 20
Script.registerSwitch(
    '', 'MaxFiles=',
    '   Print only <MaxFiles> lines on stdout (%d if output, else All)' %
    maxFiles)
Script.setUsageMessage('\n'.join([
    __doc__.split('\n')[1], 'Usage:',
    '  %s [option|cfgfile] ... ProdID Type' % Script.scriptName
]))

Script.parseCommandLine()
Esempio n. 19
0
if __name__ == '__main__':

    # Script initialization
    from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script
    import DIRAC

    Script.setUsageMessage('\n'.join([
        __doc__,
        'Usage:',
        '  %s [option|cfgfile] [values]' % Script.scriptName,
    ]))
    dmScript = DMScript()
    dmScript.registerNamespaceSwitches()  # Directory
    dmScript.registerFileSwitches()  # File, LFNs
    dmScript.registerBKSwitches()
    Script.registerSwitch('', 'FixBK', '   Take action to fix the BK')
    Script.registerSwitch('', 'FixFC', '   Take action to fix the FC')
    Script.registerSwitch(
        '', 'AffectedRuns',
        '   List the runs affected by the encountered problem')
    Script.parseCommandLine(ignoreErrors=True)

    from DIRAC import gLogger
    fixBK = False
    fixFC = False
    listAffectedRuns = False
    for switch in Script.getUnprocessedSwitches():
        if switch[0] == 'FixFC':
            fixFC = True
        if switch[0] == 'FixBK':
            fixBK = True
#!/usr/bin/env python
"""
Remove replicas of a (list of) LFNs from all non-ARCHIVE storage elements
"""

__RCSID__ = "$Id$"

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

if __name__ == "__main__":
  dmScript = DMScript()
  dmScript.registerFileSwitches()
  dmScript.registerBKSwitches()

  Script.registerSwitch("", "Force", " use this option for force the removal of files without ARCHIVE")
  Script.setUsageMessage('\n'.join(__doc__.split('\n') + [
      'Usage:',
      '  %s [option|cfgfile] ... [LFN[,LFN2[,LFN3...]]] SE[,SE2...]' % Script.scriptName]))
  Script.parseCommandLine()

  from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeRemoveReplicas
  from DIRAC import exit
  exit(executeRemoveReplicas(dmScript, allDisk=True))
Esempio n. 21
0
# File :   dirac-admin-lfn-replicas
# Author : Stuart Paterson
########################################################################
"""
    Show replicas for a (set of) LFNs
"""
__RCSID__ = "$Id$"
__VERSION__ = "$Revision: 86918 $"

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

if __name__ == "__main__":

    dmScript = DMScript()
    dmScript.registerFileSwitches()
    Script.registerSwitch('a', "All", "  Also show inactive replicas")
    Script.registerSwitch('', 'DiskOnly', '  Show only disk replicas')
    Script.registerSwitch('', 'PreferDisk',
                          "  If disk replica, don't show tape replicas")
    Script.registerSwitch('', 'ForJobs',
                          '  Select only replicas that can be used for jobs')

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

    Script.parseCommandLine(ignoreErrors=False)

    from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeLfnReplicas
#!/usr/bin/env python
"""
    Set a (set of) LFNs as problematic in the FC and in the BK and transformation system if all replicas are problematic
"""
__RCSID__ = "$Id$"
__VERSION__ = "$Revision: 87258 $"

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

if __name__ == "__main__":

  dmScript = DMScript()
  dmScript.registerFileSwitches()
  dmScript.registerSiteSwitches()

  Script.registerSwitch('', 'Reset', '   Reset files to OK')
  Script.registerSwitch('', 'Full', '   Give full list of files')
  Script.registerSwitch('', 'NoAction', '   No action taken, just give stats')

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

  Script.parseCommandLine(ignoreErrors=False)

  from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeSetProblematicFiles
  from DIRAC import exit
  exit(executeSetProblematicFiles(dmScript))
#!/usr/bin/env python
########################################################################
# File :    dirac-dms-replicate-to-run-destination
# Author  : Philippe Charpentier
########################################################################
"""
  Replicate a (list of) existing LFN(s) to Ses defined by the run destination
"""
__RCSID__ = "$Id$"

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

if __name__ == "__main__":
    dmScript = DMScript()
    dmScript.registerFileSwitches()
    dmScript.registerSiteSwitches()

    Script.registerSwitch('', 'RemoveSource',
                          '   If set, the source replica(s) will be removed')

    Script.setUsageMessage('\n'.join([
        __doc__, 'Usage:',
        '  %s [option|cfgfile] ...  [LFN1[,LFN2,[...]]] Dest[,Dest2[,...]] [Source [Cache]]'
        % Script.scriptName, 'Arguments:', '  Dest:     Valid DIRAC SE(s)'
    ]))
    Script.parseCommandLine(ignoreErrors=True)

    from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeReplicateToRunDestination
    from DIRAC import exit
    exit(executeReplicateToRunDestination(dmScript))
Esempio n. 24
0
########################################################################
# File :    dirac-bookkeeping-get-file-sisters
# Author :  Zoltan Mathe
########################################################################
"""
  Report sisters or cousins (i.e. descendant of a parent or ancestor) for a (list of) LFN(s)
"""
__RCSID__ = "$Id$"

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

if __name__ == "__main__":

    dmScript = DMScript()
    dmScript.registerFileSwitches()
    Script.registerSwitch('', 'All',
                          'Do not restrict to sisters with replicas')
    Script.registerSwitch('', 'Full',
                          'Get full metadata information on sisters')
    level = 1
    Script.registerSwitch(
        '', 'Depth=',
        'Number of ancestor levels (default:%d), 2 would be cousins, 3 grand-cousins etc...'
        % level)
    Script.registerSwitch(
        '', 'Production=',
        'Production to check for sisters (default=same production)')
    Script.registerSwitch('', 'AllFileTypes',
                          'Consider also files with a different type')
    Script.setUsageMessage('\n'.join([
        __doc__.split('\n')[1], 'Usage:',
        '  %s [option|cfgfile] ... [LFN|File] [Level]' % Script.scriptName
Esempio n. 25
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)
Esempio n. 26
0
#!/usr/bin/env python
"""
  Remove the given file or a list of files from the File Catalog and from the storage
"""
__RCSID__ = "$Id$"

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

if __name__ == "__main__":
    dmScript = DMScript()
    dmScript.registerBKSwitches()
    dmScript.registerFileSwitches()

    Script.registerSwitch(
        '', 'IncludeProcessedFiles',
        '  Forced to set Removed the files in status Processed (default:not reset)'
    )
    Script.setUsageMessage('\n'.join([
        __doc__,
        'Usage:',
        '  %s [option|cfgfile] [<LFN>] [<LFN>...]' % Script.scriptName,
    ]))

    Script.parseCommandLine()

    from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeRemoveFiles
    from DIRAC import exit
    exit(executeRemoveFiles(dmScript))
Esempio n. 27
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')
Esempio n. 28
0
if __name__ == '__main__':

    # Script initialization
    from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script
    from DIRAC import gLogger

    Script.setUsageMessage('\n'.join([
        __doc__,
        'Usage:',
        '  %s [option|cfgfile] [values]' % Script.scriptName,
    ]))
    dmScript = DMScript()
    dmScript.registerBKSwitches()
    dmScript.registerFileSwitches()
    Script.registerSwitch('', 'FixIt', '   Take action to fix the catalogs')
    Script.registerSwitch('', 'CheckAllFlags',
                          '   Consider also files with replica flag NO')
    Script.parseCommandLine(ignoreErrors=True)

    fixIt = False
    checkAll = False
    production = 0
    for opt, val in Script.getUnprocessedSwitches():
        if opt == 'FixIt':
            fixIt = True
        elif opt == 'CheckAllFlags':
            checkAll = True

    # imports
    from LHCbDIRAC.DataManagementSystem.Client.ConsistencyChecks import ConsistencyChecks