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
- set replicaFlag = No in the BK for those files that are not in the FC ''' __RCSID__ = "$Id$" # Code 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':
#!/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(',')]
#!/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 ]))
for site in sites: siteSEs += dmsHelper.getSEsForSite(site).get('Value', []) if seList and siteSEs: seList = list(set(seList) & set(siteSEs)) else: 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
#!/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))
######################################################################## # File : dirac-bookkeeping-productions-summary # Author : Zoltan Mathe ######################################################################## """ Retrieve production summary from the Bookkeeping """ __RCSID__ = "$Id$" import DIRAC from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script dmScript = DMScript() dmScript.registerBKSwitches() Script.setUsageMessage('\n'.join([ __doc__.split('\n')[1], 'Usage:', ' %s [option|cfgfile] ...' % Script.scriptName ])) Script.parseCommandLine(ignoreErrors=True) args = Script.getPositionalArgs() exitCode = 0 from LHCbDIRAC.BookkeepingSystem.Client.BookkeepingClient import BookkeepingClient bk = BookkeepingClient() bkQuery = dmScript.getBKQuery() if not bkQuery: print "No BKQuery given..." DIRAC.exit(1)
#! /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 )
""" 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 """ 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
#!/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 ]))
#!/usr/bin/env python ######################################################################## # File : dirac-dms-lfn-metadata # Author : Philippe Charpentier ######################################################################## """ Get the metadata of a (list of) LFNs from the FC """ __RCSID__ = "$Id$" from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script if __name__ == "__main__": dmScript = DMScript() dmScript.registerFileSwitches() dmScript.registerSiteSwitches() Script.setUsageMessage('\n'.join([ __doc__.split('\n')[1], 'Usage:', ' %s [option|cfgfile] ... [LFN[,LFN2[,LFN3...]]]' % Script.scriptName, 'Arguments:', ' LFN: Logical File Name or file containing LFNs' ])) Script.parseCommandLine(ignoreErrors=True) from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeLfnMetadata from DIRAC import exit exit(executeLfnMetadata(dmScript))
######################################################################## # 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(',')
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')
# 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))
#!/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)
#!/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()
#! /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 """ 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))
If --FixFC is set, remove from SE and FC If --FixBK is set and no replica flag, set replica flag in the BK ''' __RCSID__ = "$Id$" # Code 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
#!/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))
# 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
# File : dirac-dms-get-file # Author : Stuart Paterson ######################################################################## """ Retrieve a single file or list of files from Grid storage to the current directory. """ __RCSID__ = "$Id$" import os from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script if __name__ == "__main__": dmScript = DMScript() dmScript.registerFileSwitches() dmScript.registerNamespaceSwitches('download to (default = %s)' % os.path.realpath('.')) Script.setUsageMessage('\n'.join([ __doc__, 'Usage:', ' %s [option|cfgfile] [<LFN>] [<LFN>...] [SourceSE]' % Script.scriptName, ])) Script.parseCommandLine(ignoreErrors=False) from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeGetFile from DIRAC import exit exit(executeGetFile(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))
######################################################################## # 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
#! /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)
#!/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))
#!/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')
#!/usr/bin/env python ######################################################################## # File : dirac-dms-register-bk2fc # Author : Philippe Charpentier ######################################################################## """ Given a (list of) LFNs and SEs, check for existence of a file and register in the FC if the file exists """ __RCSID__ = "$Id$" from LHCbDIRAC.DataManagementSystem.Client.DMScript import DMScript, Script if __name__ == "__main__": dmScript = DMScript() dmScript.registerFileSwitches() dmScript.registerSiteSwitches() Script.setUsageMessage('\n'.join([ __doc__, 'Usage:', ' %s [option|cfgfile] ... [LFN1[,LFN2,[...]]] [--SE] Dest[,Dest2[,...]] ' % Script.scriptName, 'Arguments:', ' Dest: Valid DIRAC SE(s)' ])) Script.parseCommandLine(ignoreErrors=True) from LHCbDIRAC.DataManagementSystem.Client.ScriptExecutors import executeRegisterBK2FC from DIRAC import exit exit(executeRegisterBK2FC(dmScript))