本文整理汇总了Python中DIRAC.Interfaces.API.Dirac.Dirac.getReplicas方法的典型用法代码示例。如果您正苦于以下问题:Python Dirac.getReplicas方法的具体用法?Python Dirac.getReplicas怎么用?Python Dirac.getReplicas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Interfaces.API.Dirac.Dirac
的用法示例。
在下文中一共展示了Dirac.getReplicas方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: in
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import getReplicas [as 别名]
Script.parseCommandLine( ignoreErrors = True )
lfns = Script.getPositionalArgs()
switches = Script.getUnprocessedSwitches()
active = True
for switch in switches:
opt = switch[0].lower()
if opt in ( "a", "all" ):
active = False
if len( lfns ) < 1:
Script.showHelp()
from DIRAC.Interfaces.API.Dirac import Dirac
dirac = Dirac()
exitCode = 0
if len( lfns ) == 1:
try:
f = open( lfns[0], 'r' )
lfns = f.read().splitlines()
f.close()
except:
pass
result = dirac.getReplicas( lfns, active = active, printOutput = True )
if not result['OK']:
print 'ERROR: ', result['Message']
exitCode = 2
DIRAC.exit( exitCode )
示例2: open
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import getReplicas [as 别名]
if os.path.exists( fileName ):
try:
lfnFile = open( fileName )
lfns = [ k.strip() for k in lfnFile.readlines() ]
lfnFile.close()
except Exception:
DIRAC.gLogger.exception( 'Can not open file', fileName )
DIRAC.exit( -1 )
else:
lfns = args[1:]
dirac = Dirac()
res = dirac.getReplicas( lfns[0:], active = True, printOutput = False )
if not res['OK']:
DIRAC.gLogger.error( res['Message'] )
DIRAC.exit( -1 )
stagerClient = StorageManagerClient()
stageLfns = []
for lfn, replicas in res['Value']['Successful'].items():
if seName in replicas:
stageLfns.append( lfn )
if len( stageLfns ) >= 10:
# Use a fake JobID = 0
request = stagerClient.setRequest( { seName : stageLfns }, 'WorkloadManagement',
'[email protected]/JobStateUpdate', 0 )