ATLAS Offline Software
Loading...
Searching...
No Matches
python.DiskUtils.EOS Class Reference
Inheritance diagram for python.DiskUtils.EOS:
Collaboration diagram for python.DiskUtils.EOS:

Public Member Functions

 __init__ (self, prefix='root://eosatlas.cern.ch/')
 wrap (self, path)
 unwrap (self, path)
 exists (self, path)
 is_file (self, path)
 is_directory (self, path)
 children (self, path)
 glob (self, pattern)

Public Attributes

 prefix = prefix

Protected Member Functions

 _call (self, *args)

Detailed Description

 Accesses EOS using the command line interface.
NB: when EOS is fuse-mounted on /eos this class is not really necessary.

Definition at line 212 of file DiskUtils.py.

Constructor & Destructor Documentation

◆ __init__()

python.DiskUtils.EOS.__init__ ( self,
prefix = 'root://eosatlas.cern.ch/' )

Definition at line 217 of file DiskUtils.py.

217 def __init__(self, prefix='root://eosatlas.cern.ch/'):
218 self.prefix = prefix
219

Member Function Documentation

◆ _call()

python.DiskUtils.EOS._call ( self,
* args )
protected

Definition at line 245 of file DiskUtils.py.

245 def _call(self, *args):
246 with open(os.devnull, 'w') as null:
247 retcode = subprocess.call(args, stderr=null)
248 return retcode
249

◆ children()

python.DiskUtils.EOS.children ( self,
path )

Reimplemented from python.DiskUtils.Backend.

Definition at line 239 of file DiskUtils.py.

239 def children(self, path):
240 with open(os.devnull, 'w') as null:
241 output = subprocess.check_output(['eos', '-b', 'find', '-f',
242 self.unwrap(path)], stderr=null)
243 return [l.strip() for l in output.split('\n')]
244

◆ exists()

python.DiskUtils.EOS.exists ( self,
path )

Reimplemented from python.DiskUtils.Backend.

Definition at line 230 of file DiskUtils.py.

230 def exists(self, path):
231 return self._call('eos', '-b', 'ls', '-s', self.unwrap(path)) == 0
232
bool exists(const std::string &filename)
does a file exist

◆ glob()

python.DiskUtils.Backend.glob ( self,
pattern )
inherited

Reimplemented in python.DiskUtils.Local.

Definition at line 194 of file DiskUtils.py.

194 def glob(self, pattern): raise NotImplementedError

◆ is_directory()

python.DiskUtils.EOS.is_directory ( self,
path )

Reimplemented from python.DiskUtils.Backend.

Definition at line 236 of file DiskUtils.py.

236 def is_directory(self, path):
237 return self._call('eos', '-b', 'sat', '-d', self.unwrap(path)) == 0
238

◆ is_file()

python.DiskUtils.EOS.is_file ( self,
path )

Reimplemented from python.DiskUtils.Backend.

Definition at line 233 of file DiskUtils.py.

233 def is_file(self, path):
234 return self._call('eos', '-b', 'sat', '-f', self.unwrap(path)) == 0
235

◆ unwrap()

python.DiskUtils.EOS.unwrap ( self,
path )

Definition at line 225 of file DiskUtils.py.

225 def unwrap(self, path):
226 if path.startswith(self.prefix):
227 path = path[len(self.prefix):]
228 return path
229

◆ wrap()

python.DiskUtils.EOS.wrap ( self,
path )

Reimplemented from python.DiskUtils.Backend.

Definition at line 220 of file DiskUtils.py.

220 def wrap(self, path):
221 if path.startswith('/'):
222 path = self.prefix + path
223 return path
224

Member Data Documentation

◆ prefix

python.DiskUtils.EOS.prefix = prefix

Definition at line 218 of file DiskUtils.py.


The documentation for this class was generated from the following file: