def resolvePFNs(url1, url2): ssite, slfn = url1.split(":", 1) dsite, dlfn = url2.split(":", 1) p = PhEDEx.PhEDEx() dest_info = p.getPFN(nodes=[dsite, ssite], lfns=[dlfn, slfn]) return dest_info[ssite, slfn], dest_info[dsite, dlfn]
def __init__(self, *args, **kwargs): TaskAction.TaskAction.__init__(self, *args, **kwargs) self.phedex = PhEDEx.PhEDEx() #TODO use config certs!
connectToDB() myThread = threading.currentThread() results = [] for result in myThread.dbi.processData(sql): results.extend(result.fetchall()) blocks = {} for row in results: if row[0] not in blocks: blocks[row[0]] = [] blocks[row[0]].append(row[1]) phedex = PhEDEx.PhEDEx({"endpoint": "https://cmsweb.cern.ch/phedex/datasvc/json/prod/"}, "json") for blockName in blocks: print("%s:" % blockName) args = {} args["block"] = blockName result = phedex._getResult("filereplicas", args = args, verb = "POST") blockFiles = [] for phedexFile in result["phedex"]["block"][0]["file"]: blockFiles.append(phedexFile["name"]) if len(blockFiles) != len(blocks[blockName]): print("\tFile count mismatch: %s local, %s global" % (len(blocks[blockName]), len(blockFiles)))