def manageDatasetBlocks(datasetPath, localDBS, globalDBS, phedexConfig=None, phedexNodes=None): """ _manageDatasetBlocks_ Trawl through the dataset for all remaining open blocks, and then close them, migrate them to global and inject them into PhEDEx if phedexConfig is not None, using the optional list of PhEDEx nodes if provided. """ dbs = DBSReader(localDBS) blocks = dbs.listFileBlocks(datasetPath) for block in blocks: if dbs.blockIsOpen(block): blockMgr = BlockManager(block, localDbs, globalDbs, datasetPath) blockMgr.closeBlock() blockMgr.migrateToGlobalDBS() if phedexConfig != None: blockMgr.injectBlockToPhEDEx(phedexConfig, phedexNodes) return
def makePhEDExDrop(dbsUrl, datasetPath, *blockNames): """ _makePhEDExDrop_ Given a DBS2 Url, dataset name and list of blockNames, generate an XML structure for injection """ spec = XMLInjectionSpec(dbsUrl, datasetPath) reader = DBSReader(dbsUrl) for block in blockNames: blockContent = reader.getFileBlock(block) isOpen = reader.blockIsOpen(block) if isOpen: xmlBlock = spec.getFileblock(block, "y") else: xmlBlock = spec.getFileblock(block, "n") for x in blockContent[block]['Files']: checksums = {'cksum' : x['Checksum']} if x.get('Adler32') not in (None, ''): checksums['adler32'] = x['Adler32'] xmlBlock.addFile(x['LogicalFileName'], checksums, x['FileSize']) improv = spec.save() xmlString = improv.makeDOMElement().toprettyxml() return xmlString
def manageDatasetBlocks(datasetPath, localDBS, globalDBS, phedexConfig = None, phedexNodes = None): """ _manageDatasetBlocks_ Trawl through the dataset for all remaining open blocks, and then close them, migrate them to global and inject them into PhEDEx if phedexConfig is not None, using the optional list of PhEDEx nodes if provided. """ dbs = DBSReader(localDBS) blocks = dbs.listFileBlocks(datasetPath) for block in blocks: if dbs.blockIsOpen(block): blockMgr = BlockManager(block, localDbs, globalDbs, datasetPath) blockMgr.closeBlock() blockMgr.migrateToGlobalDBS() if phedexConfig != None: blockMgr.injectBlockToPhEDEx(phedexConfig, phedexNodes) return