本文整理汇总了Python中DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient.removeFile方法的典型用法代码示例。如果您正苦于以下问题:Python FileCatalogClient.removeFile方法的具体用法?Python FileCatalogClient.removeFile怎么用?Python FileCatalogClient.removeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient
的用法示例。
在下文中一共展示了FileCatalogClient.removeFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient [as 别名]
# 或者: from DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient import removeFile [as 别名]
if not res['OK']:
extra += res['Message']
else:
extra += "%s %s %s"%(len(lfnDict), len(res['Value'].get('Successful', [])), len(res['Value'].get('Failed', [])))
pass
fl.write("%s\t%s\t%s\t%s\n"%(beforeI, afterI, queryInsertTime, extra))
fl.flush()
os.fsync(fl)
fl2.write("%s\t%s\t%s\t%s\n"%(beforeCI, afterCI, queryInsertTimeC, extra))
fl2.flush()
os.fsync(fl2)
beforeR = time.time()
beforeCR = time.clock()
res = fc.removeFile(lfnDict)
afterCR = time.clock()
afterR = time.time()
queryRemoveTimeC = afterCR - beforeCR
queryRemoveTime = afterR - beforeR
extra = "remove "
if not res['OK']:
extra += res['Message']
else:
extra += "%s %s %s"%(nbOfFiles, len(res['Value'].get('Successful', [])), len(res['Value'].get('Failed', [])))
pass
fl.write("%s\t%s\t%s\t%s\n"%(beforeR, afterR, queryRemoveTime, extra))
fl.flush()
os.fsync(fl)
fl2.write("%s\t%s\t%s\t%s\n"%(beforeCR, afterCR, queryRemoveTimeC, extra))
示例2: __init__
# 需要导入模块: from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient [as 别名]
# 或者: from DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient import removeFile [as 别名]
#.........这里部分代码省略.........
if self.__registerDir(dir_streamId)["OK"]:
result = self.__registerDirMetadata(dir_streamId, {"streamId": metaDict["streamId"]})
if result["OK"]:
result = self.__registerDirMetadata(dir_streamId, lastDirMetaDict)
if result["OK"]:
creation_OK = 1
else:
creation_OK = 2
else:
result = self.__registerDirMetadata(dir_round, lastDirMetaDict)
if result["OK"]:
creation_OK = 1
if (creation_OK == 1) | (creation_OK == 2):
if metaDict["streamId"] == "stream0":
return dir_round
else:
return dir_streamId
##########################################################################################
# dir options
def removeDir(self, dir):
"""remove the dir include files and subdirs
"""
result = self.client.listDirectory(dir)
if result["OK"]:
if not result["Value"]["Successful"][dir]["Files"] and not result["Value"]["Successful"][dir]["SubDirs"]:
# print 'no file and subDirs in this dir'
self.client.removeDirectory(dir)
return S_OK()
else:
if result["Value"]["Successful"][dir]["Files"]:
for file in result["Value"]["Successful"][dir]["Files"]:
self.client.removeFile(file)
else:
for subdir in result["Value"]["Successful"][dir]["SubDirs"]:
self.removeDir(subdir)
self.removeDir(dir)
def listDir(self, dir):
"""list the files under the given DFC dir"""
fileList = []
result = self.client.listDirectory(dir)
if result["OK"]:
if result["Value"]["Successful"][dir]["Files"]:
fileList = result["Value"]["Successful"][dir]["Files"].keys()
fileList.sort()
else:
print "no files under this dir"
return fileList
def getDirMetaVal(self, dir):
"""list the registed metadata value of the given dir"""
result = self.client.getDirectoryMetadata(dir)
if result["OK"]:
return result["Value"]
else:
print "Failed to get meta Value of the directory"
return {}
#################################################################################
# meta fields operations
#
def addNewFields(self, fieldName, fieldType, metaType="-d"):
"""add new fields,if metaType is '-f',add file field,
fileType is datatpye in MySQL notation