if catalog.isDir( lfn ): # we can accept one ore more local files for lp in local_paths: pairs.append( (lp, os.path.join( lfn, os.path.basename( lp )) )) else: if len( local_paths ) > 1: print "Error: Destination LFN must be a directory when registering multiple local files" Script.showHelp( ) DIRAC.exit( -1 ) # lfn filename replace local filename pairs.append( (local_path, lfn )) # destination SE se = params.destinationSE if not se: retVal = session.getEnv( "default_se", "DIRAC-USER" ) if not retVal[ "OK" ]: critical( retVal[ "Message" ] ) se = retVal[ "Value" ] Script.enableCS( ) from DIRAC.DataManagementSystem.Client.FileCatalogClientCLI import FileCatalogClientCLI fccli = FileCatalogClientCLI( catalog.catalog ) for local_path, lfn in pairs: fccli.do_add( lfn + " " + local_path + " " + se )
print "Error: No argument provided\n%s:" % Script.scriptName Script.showHelp() DIRAC.exit( -1 ) # default lfn: same file name as local_path lfns = pathFromArguments( session, args ) # destination SE dsts = [ ] if params.destinationSE: dsts = params.destinationSE.split( "," ) else: dsts = session.getReplicationSEs() if not dsts: dsts = [ session.getEnv( "default_se", "DIRAC-USER" )[ "Value" ] ] srcopt = "" if params.sourceSE: srcopt = " " + params.sourceSE Script.enableCS() from DIRAC.DataManagementSystem.Client.FileCatalogClientCLI import FileCatalogClientCLI fccli = FileCatalogClientCLI( catalog.catalog ) for lfn in lfns: for dst in dsts: # print "replicating", lfn, "to SE", dst fccli.do_replicate( lfn + " " + dst + srcopt )
retVal = session.listEnv( ) if not retVal[ "OK" ]: print "Error:", retVal[ "Message" ] DIRAC.exit( -1 ) for o, v in retVal[ "Value" ]: print o + "=" + v DIRAC.exit( 0 ) arg = args[ 0 ] section = None option = None if "." in arg: section, option = arg.split( "." ) else: option = arg ret = None if section: ret = session.get( section, option ) else: ret = session.getEnv( option ) if not ret[ "OK" ]: print critical( ret[ "Message" ] ) print ret[ "Value" ]