本文整理汇总了Python中DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient.changePathGroup方法的典型用法代码示例。如果您正苦于以下问题:Python FileCatalogClient.changePathGroup方法的具体用法?Python FileCatalogClient.changePathGroup怎么用?Python FileCatalogClient.changePathGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient
的用法示例。
在下文中一共展示了FileCatalogClient.changePathGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addUserToFC
# 需要导入模块: from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient [as 别名]
# 或者: from DIRAC.Resources.Catalog.FileCatalogClient.FileCatalogClient import changePathGroup [as 别名]
def addUserToFC(clip):
"""
Add the user to the filecatalog
Try to figure out in which VOs the user must be, and create the catalog entries accordingly
"""
from DIRAC.ConfigurationSystem.Client.Helpers import Registry
from DIRAC.Resources.Catalog.FileCatalogClient import FileCatalogClient
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
fc = FileCatalogClient()
res = fc.addUser(clip.uname)
if not res['OK']:
gLogger.error("Failed to add user to FC, but it does not really matter:", res['Message'])
gLogger.error("Add by hand (in the FC-CLI: user add %s)" %(clip.uname) )
bpath = ''
for grp in clip.groups:
bpath = '/'
voName = Registry.getVOForGroup(grp)
if not voName:
gLogger.error("NO VO for group", grp )
continue
bpath += voName+"/"
lfnprefix = Operations( vo = voName ).getValue("LFNUserPrefix")
if lfnprefix:
bpath += lfnprefix+"/"
bpath += clip.uname[0]+"/"+clip.uname
res = fc.createDirectory(bpath)
if not res['OK']:
gLogger.error(res['Message'])
continue
res = fc.changePathGroup({ bpath: grp }, False)
if not res['OK']:
gLogger.error(res['Message'])
res = fc.changePathOwner({ bpath: clip.uname }, False)
if not res['OK']:
gLogger.error(res['Message'])
res = fc.setMetadata(bpath, {"Owner":clip.uname})
if not res['OK']:
gLogger.error(res['Message'])