CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
eostools Namespace Reference

Functions

def _xrdcpSingleFile
 
def cat
 
def chmod
 
def cmsStage
 
def createEOSDir
 
def datasetNotEmpty
 
def eosDirSize
 
def eosToLFN
 
def fileExists
 
def isDirectory
 
def isEOS
 
def isEOSDir
 
def isEOSFile
 
def isFile
 
def isLFN
 
def lfnToEOS
 
def lfnToPFN
 
def listFiles
 
def ls
 
def ls_EOS
 
def matchingFiles
 
def mkdir
 
def move
 
def remove
 
def rm
 
def runEOSCommand
 
def runXRDCommand
 
def setCAFPath
 
def which
 
def xrdcp
 

Variables

 castorToLFN = eosToLFN
 
 createCastorDir = createEOSDir
 
string eos_select = '/afs/cern.ch/project/eos/installation/cms/bin/eos.select'
 
 isCastorDir = isEOSDir
 
 isCastorFile = isEOSFile
 
 lfnToCastor = lfnToEOS
 

Function Documentation

def eostools._xrdcpSingleFile (   pfn_src,
  pfn_dest 
)
private
Copies a single file using xrd.

Definition at line 494 of file eostools.py.

def eostools.cat (   path)
def eostools.chmod (   path,
  mode 
)
Does chmod on a file or directory

Definition at line 293 of file eostools.py.

def eostools.cmsStage (   absDestDir,
  files,
  force 
)
Runs cmsStage with LFNs if possible

Definition at line 537 of file eostools.py.

def eostools.createEOSDir (   path)
Makes a directory in EOS

???Will, I'm quite worried by the fact that if this path already exists, and is
a file, everything will 'work'. But then we have a file, and not a directory,
while we expect a dir...

Definition at line 229 of file eostools.py.

def eostools.datasetNotEmpty (   path,
  regexp 
)

Definition at line 528 of file eostools.py.

def eostools.eosDirSize (   path)
Returns the size of a directory on EOS in GB.

Definition at line 215 of file eostools.py.

def eostools.eosToLFN (   path)
Converts a EOS PFN to an LFN.

Just strip out /eos/cms from path.
If this string is not found, return path.
??? Shouldn't we raise an exception instead?

Definition at line 65 of file eostools.py.

def eostools.fileExists (   path)
Returns true if path is a file or directory stored locally, or on EOS.

This function checks for the file or directory existence.

Definition at line 197 of file eostools.py.

def eostools.isDirectory (   path)
Returns True if path is a directory on EOS.

Tests for file existence. 
This function returns False for EOS files, and crashes with local paths

???Will, this function also seems to work for paths like:
/eos/cms/...
??? I think that it should work also for local files, see isFile.

Definition at line 260 of file eostools.py.

def eostools.isEOS (   path)
Tests whether this path is a CMS EOS (name starts with /eos...)

Definition at line 61 of file eostools.py.

def eostools.isEOSDir (   path)
Returns True if path is either:
/store/...
or
/eos/cms/store/...
or
root://eoscms.cern.ch//eos/cms/

Otherwise, returns False.

WARNING!! This function does not check for path existence,
and returns true also for plain files.
!!! Will, is my summary correct? 

Definition at line 121 of file eostools.py.

def eostools.isEOSFile (   path,
  tfcProt = 'rfio' 
)
Returns True if path is a file or directory stored on EOS (checks for path existence)
??? This function does not behave well if passed a non EOS path...
returns lots of error messages like:
>>> eostools.isEOSFile('/store/asdfasfd')
Command (['ls', '/', 's', 't', 'o', 'r', 'e', '/', 'a', 's', 'd', 'f', 'a', 's', 'f', 'd', '/store']) failed with return code: 2
ls: s: No such file or directory
ls: t: No such file or directory
ls: o: No such file or directory
ls: r: No such file or directory
ls: e: No such file or directory
ls: a: No such file or directory
ls: s: No such file or directory
ls: d: No such file or directory
ls: f: No such file or directory
ls: a: No such file or directory
ls: s: No such file or directory
ls: f: No such file or directory
ls: d: No such file or directory
ls: /store: No such file or directory

ls: s: No such file or directory
ls: t: No such file or directory
ls: o: No such file or directory
ls: r: No such file or directory
ls: e: No such file or directory
ls: a: No such file or directory
ls: s: No such file or directory
ls: d: No such file or directory
ls: f: No such file or directory
ls: a: No such file or directory
ls: s: No such file or directory
ls: f: No such file or directory
ls: d: No such file or directory
ls: /store: No such file or directory

False

Definition at line 152 of file eostools.py.

def eostools.isFile (   path)
Returns True if a path is a file.

Tests for file existence.
Returns False for directories.
Works on EOS and local paths.

???This function works with local files, so not the same as isDirectory...
isFile and isDirectory should behave the same.

Definition at line 273 of file eostools.py.

def eostools.isLFN (   path)
Tests whether this path is a CMS LFN (name starts with /store...)

Definition at line 56 of file eostools.py.

def eostools.lfnToEOS (   path)
Converts LFN to EOS.

If path is not an LFN in the first place, return path.
??? shouldn't we raise an exception?

Definition at line 107 of file eostools.py.

def eostools.lfnToPFN (   path,
  tfcProt = 'rfio' 
)
Converts an LFN to a PFN. For example:
/store/cmst3/user/cbern/CMG/TauPlusX/Run2011A-03Oct2011-v1/AOD/V2/PAT_CMG_V2_4_0/H2TAUTAU_Nov21
->
root://eoscms//eos/cms/store/cmst3/user/cbern/CMG/TauPlusX/Run2011A-03Oct2011-v1/AOD/V2/PAT_CMG_V2_4_0/H2TAUTAU_Nov21?svcClass=cmst3&stageHost=castorcms

This function only checks path, and does not access the storage system.
If the path is in /store/cmst3, it assumes that the CMST3 svcClass is to be used.
Otherwise, is uses the default one. 

??? what is tfcprot? 

Definition at line 76 of file eostools.py.

def eostools.listFiles (   path,
  rec = False,
  full_info = False 
)
Provides a list of the specified directory

Definition at line 299 of file eostools.py.

def eostools.ls (   path,
  rec = False 
)
def eostools.ls_EOS (   path,
  rec = False 
)
Provides a simple list of the specified directory, works on EOS only, but is faster than the xrd version

Definition at line 352 of file eostools.py.

def eostools.matchingFiles (   path,
  regexp 
)
Return a list of files matching a regexp

Definition at line 518 of file eostools.py.

def eostools.mkdir (   path)
Create a directory, either on EOS or locally

Definition at line 250 of file eostools.py.

Referenced by L1GtVhdlWriter.analyze().

def eostools.move (   src,
  dest 
)
Move filename1 to filename2 locally to the same server

Definition at line 510 of file eostools.py.

Referenced by CompatibleDetToGroupAdder.add(), tracking::TempMeasurements.add(), clangcms::FiniteMathChecker.checkPreStmt(), edm::LuminosityBlock.commit_(), edm::Run.commit_(), edm.convert_handle(), edm::SharedResourcesRegistry.createAcquirer(), edm::SharedResourcesRegistry.createAcquirerForSourceDelayedReader(), edm::impl.createCommunicatorIfNeeded(), edm::OutputModuleCommunicatorT< T >.createIfNeeded(), edm::maker::ModuleHolderT< T >.createOutputModuleCommunicator(), MillePedeFileConverter.endLuminosityBlockProduce(), MeasurementDet.fastMeasurements(), HPDNoiseGenerator.fillNoiseSignals(), BadGlobalMuonTagger.filter(), L1GTPrescaler.filter(), LocalMaximumSeedFinder.findSeeds(), edm::EventBase.get(), edm.getAnyPtr(), PileUpEventPrincipal.getByLabel(), edm::Event.getByLabel(), edm::EventBase.getByLabel(), edm::RunBase.getByLabel(), edm::LuminosityBlockBase.getByLabel(), edm.getWrapperBasePtr(), TBLayer.groupedCompatibleDetsV(), PFHBHERecHitCreator.importRecHits(), PFHcalRecHitCreator< Digi, Geometry, Layer, Detector >.importRecHits(), PFEcalRecHitCreator< Geometry, Layer, Detector >.importRecHits(), PFPSRecHitCreator.importRecHits(), HitTripletGeneratorFromPairAndLayers.init(), MultiHitGeneratorFromPairAndLayers.init(), TransientInitialStateEstimator.innerState(), edm::ParentageRegistry.insertMapped(), GeomDetCompatibilityChecker.isCompatible(), L1MuBMTFSetup.L1MuBMTFSetup(), L1MuDTTFSetup.L1MuDTTFSetup(), edm.makeESHandleExceptionFactory(), edm.makeHandleExceptionFactory(), TrajectoryFitter.makeVect(), TkPixelMeasurementDet.measurements(), DetGroupMerger.mergeTwoLevels(), LocalStorageMaker.open(), DCacheStorageMaker.open(), StormStorageMaker.open(), StormLcgGtStorageMaker.open(), RFIOStorageMaker.open(), CaloTDigitizerDefaultRun< Traits >.operator()(), extstd::clone_ptr< Bounds >.operator=(), DetGroupElement.operator=(), ProxyBase11< T >.operator=(), reco::TransientTrack.operator=(), edm::RefVectorBase< key_type >.operator=(), DetGroupMerger.orderAndMergeTwoLevels(), ShallowEventDataProducer.produce(), TrackingParticleConversionSelector.produce(), edm::EventAuxiliaryHistoryProducer.produce(), SeedCombiner.produce(), TrackingParticleNumberOfLayersProducer.produce(), JetCollectionReducerT< T >.produce(), GeneratorSmearedProducer.produce(), PFMatchedCandidateRefExtractor.produce(), EmptySimHits.produce(), evf::EvFFEDSelector.produce(), VertexAssociatorByPositionAndTracksProducer.produce(), VertexAssociatorByTracksProducer.produce(), PFMuonUntagger.produce(), MuIsoDepositCopyProducer.produce(), pat::PackedPFCandidateRefMixer.produce(), FastTrackerRecHitCombiner.produce(), PFCandidateMuonUntagger.produce(), JetTracksAssociationToTrackRefs.produce(), FastTrackerRecHitMaskProducer.produce(), BaseEvtVtxGenerator.produce(), CTPPSDiamondLocalTrackFitter.produce(), GsfElectronCoreGSCrysFixer.produce(), CombinedRecHitCollectionProducer.produce(), CTPPSDiamondRecHitProducer.produce(), CorrMETDataExtractor.produce(), MixEvtVtxGenerator.produce(), edm::LogErrorHarvester.produce(), JetCorrectorProducer< T >.produce(), edm::TriggerResultInserter.produce(), TrackMVAClassifierBase.produce(), TrackMCQuality.produce(), TrackAssociatorByPositionProducer.produce(), HLTScoutingMuonProducer.produce(), EGGainSwitchFlagProducer< C >.produce(), ExtraFromSeeds.produce(), DeepNNTagInfoProducer.produce(), TrackAssociatorByChi2Producer.produce(), GenHIEventProducer.produce(), CorrectedECALPFClusterProducer.produce(), ChainedJetCorrectorProducer.produce(), edm::ProductProvenance.ProductProvenance(), edm::RunPrincipal.put(), edm::LuminosityBlockPrincipal.put(), edm::ESProxyFactoryProducer.registerFactoryWithKey(), VertexFitterManager.registerFitter(), PFEGammaToCandidateRemapper.run(), reco::formula::BinaryOperatorEvaluatorBase.setLeftEvaluator(), reco::formula::BinaryOperatorEvaluatorBase.setRightEvaluator(), edm::ProductData.setWrapper(), DDValue::StringHolder.StringHolder(), TempTrajectory.TempTrajectory(), DTSegtoRPC.thePoints(), CSCSegtoRPC.thePoints(), TracktoRPC.thePoints(), TrajectorySmoother.trajectories(), TrajectoryBuilder.trajectories(), edm::ProductData.unsafe_setWrapper(), PFMuonUntagger.writeAssociation(), PFCandidateMuonUntagger.writeValueMap(), PFMuonUntagger.writeValueMap(), l1t::stage2::GMTCollections.~GMTCollections(), and TrackCollectionCloner::Producer.~Producer().

def eostools.remove (   files,
  rec = False 
)
Remove a list of files and directories, possibly recursively

Colin: Is that obsolete? why not use rm?

Definition at line 381 of file eostools.py.

def eostools.rm (   path,
  rec = False 
)
rm, works on EOS and locally.

Colin: should implement a -f mode and a confirmation when deleting dirs recursively.

Definition at line 362 of file eostools.py.

def eostools.runEOSCommand (   path,
  cmd,
  args 
)
Run an eos command.

!!! Will, when the EOS command fails, it passes silently...
I think we should really try and raise an exception in case of problems.
should be possible as the return code is provided in the tuple returned by runner.

Definition at line 38 of file eostools.py.

def eostools.runXRDCommand (   path,
  cmd,
  args 
)
Run an xrd command.

!!! Will, what is happening in case of problem?
??? At some point, should return a list of lines instead of a string.

Definition at line 22 of file eostools.py.

def eostools.setCAFPath ( )
Hack to get the CAF scripts on the PYTHONPATH

Definition at line 13 of file eostools.py.

def eostools.which (   cmd)
def eostools.xrdcp (   src,
  dest 
)
Does a copy of files using xrd.

Colin: implement a generic cp interface as done for rm, ls, etc?

Definition at line 429 of file eostools.py.

Variable Documentation

eostools.castorToLFN = eosToLFN

Definition at line 74 of file eostools.py.

eostools.createCastorDir = createEOSDir

Definition at line 248 of file eostools.py.

string eostools.eos_select = '/afs/cern.ch/project/eos/installation/cms/bin/eos.select'

Definition at line 11 of file eostools.py.

eostools.isCastorDir = isEOSDir

Definition at line 149 of file eostools.py.

eostools.isCastorFile = isEOSFile

Definition at line 194 of file eostools.py.

eostools.lfnToCastor = lfnToEOS

Definition at line 119 of file eostools.py.