def configureFileStager(job, myInputCollections) : ##################################################################################################### # Configure the FileStager # https://twiki.cern.ch/twiki/bin/view/Main/FileStager # Note: # 1. This must (should?) be the first algorithm added to your top level AlgSequence # 2. FileStager uses the prefix gridcopy:// to decide whether to do the stagging (then removes it) # The replacement necessary replacement "rfio:/" -> "gridcopy:///" is done below # (For our dpm SE the file paths should start with gridcopy:///dpm i.e. 3 leading slashes) # 3. Make sure not to overwrite the EventSelector.InputCollections later in you job options. ##################################################################################################### ## Import file stager classes from FileStager.FileStagerConf import FileStagerAlg from FileStager.FileStagerTool import FileStagerTool ## If we are here, we want to perform file prestaging, therefore replace "rfio:/" by "gridcopy:///" myInputCollections=[ff.replace('rfio:/', 'gridcopy:///') for ff in myInputCollections] ## Configure the FileStagerTool stagetool = FileStagerTool(sampleList=myInputCollections) stagetool.CpCommand = "rfcp" stagetool.CpArguments = [] stagetool.OutfilePrefix = "" stagetool.checkGridProxy = False if stagetool.DoStaging() : print "Staging acvtivated!" print " - Copy command = ", stagetool.CpCommand print " - Copy arguments = ", stagetool.CpArguments else: print "Staging not acvtivated!" pass ## Check if collection names begin with "gridcopy" (i.e. DoStagging is True) if stagetool.DoStaging(): svcMgr.EventSelector.InputCollections = stagetool.GetStageCollections() else: svcMgr.EventSelector.InputCollections = stagetool.GetSampleList() pass ## FileStagerAlg needs to be the first algorithm added to the job. if stagetool.DoStaging(): fileStager = FileStagerAlg('FileStager') fileStager.InputCollections = stagetool.GetSampleList() fileStager.VerboseStager = True fileStager.VerboseWaiting = True fileStager.BaseTmpdir = stagetool.GetTmpdir() fileStager.InfilePrefix = stagetool.InfilePrefix fileStager.OutfilePrefix = stagetool.OutfilePrefix fileStager.CpCommand = stagetool.CpCommand fileStager.CpArguments = stagetool.CpArguments fileStager.FirstFileAlreadyStaged = stagetool.StageFirstFile fileStager.OutputLevel = INFO job += fileStager pass return