if switch[0] == 'FixFC': fixFC = True if switch[0] == 'FixBK': fixBK = True elif switch[0] == 'AffectedRuns': listAffectedRuns = True if fixFC and fixBK: gLogger.notice("Can't fix both FC and BK, please choose") DIRAC.exit(0) # imports 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(',') ] productions = dmScript.getOption('Productions', []) runs = dmScript.getOption('Runs', []) from LHCbDIRAC.DataManagementSystem.Client.CheckExecutors import doCheckFC2BK if productions and not runs: fileType = dmScript.getOption('FileType', []) if fileType: cc.fileType = fileType for prod in productions: cc.prod = prod gLogger.always("Processing production %d" % cc.prod) doCheckFC2BK(cc, fixFC, fixBK, listAffectedRuns) gLogger.always("Processed production %d" % cc.prod) else:
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(',')] bkQuery = dmScript.getBKQuery(visible='All') if bkQuery.getQueryDict() != {'Visible': 'All'}: bkQuery.setOption('ReplicaFlag', 'All') cc.bkQuery = bkQuery seList = dmScript.getOption('SEs', []) if not seList: dmScript.setSEs('Tier1-Archive') seList = dmScript.getOption('SEs', []) from LHCbDIRAC.DataManagementSystem.Client.CheckExecutors import doCheckSE doCheckSE(cc, seList, fixIt)
""" 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) dict = bkQuery.getQueryDict() dictItems = ('ConfigName', 'ConfigVersion', 'Production', 'ConditionDescription', 'ProcessingPass', 'FileType', 'EventType')