__RCSID__ = "$Id$" from DIRAC import S_OK, S_ERROR, gLogger, exit from DIRAC.Core.Base import Script Script.setUsageMessage(__doc__) args = Script.getPositionalArgs() if len(args) != 1: Script.showHelp() datasetName = args[0] from IHEPDIRAC.Badger.API.Badger import Badger badger = Badger() from DIRAC.DataManagementSystem.Client.ReplicaManager import ReplicaManager rm = ReplicaManager() result = badger.getFilesByDatasetName(datasetName) if result['OK']: fileList = result['Value'] fileCountDict = badger.reCalcCount(fileList, False) badger.removeDataset(datasetName) for file in fileCountDict: if fileCountDict[file] == 0: result = rm.removeFile(file) if not result['OK']: print "Failed remove file %s" % file exit(0)
from DIRAC.Core.Base import Script Script.setUsageMessage(__doc__) args = Script.getPositionalArgs() #print len(args) if len(args) < 3: Script.showHelp() exit(-1) datasetName = args[0] path = args[1] strArg = args[2] from IHEPDIRAC.Badger.API.Badger import Badger badger = Badger() prefix = badger.getDatasetNamePrefix() datasetName = prefix + datasetName #print datasetName result = badger.registerDataset(datasetName, path, strArg) if result['OK']: resVal = badger.getFilesByDatasetName(datasetName) if resVal['OK']: fileList = resVal['Value'] badger.reCalcCount(fileList) #print result exit(0)