Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
PhysicsTools
HeppyCore
python
utils
castorBaseDir.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
import
os, sys
3
import
eostools
as
castortools
4
5
def
getUserAndArea
(user):
6
"""Factor out the magic user hack for use in other classes"""
7
8
area =
'user'
9
10
tokens = user.split(
'_'
)
11
if
tokens
and
len(tokens) > 1:
12
user = tokens[0]
13
area = tokens[1]
14
return
user, area
15
16
def
castorBaseDir
( user=os.environ['USER'], area = None):
17
"""Gets the top level directory to use for writing for 'user'"""
18
19
if
area
is
None
:
20
user, area =
getUserAndArea
(user)
21
22
d =
'root://eoscms.cern.ch//eos/cms/store/cmst3/%s/%s/CMG'
% (area,user)
23
exists = castortools.isDirectory( castortools.lfnToCastor(d) )
24
if
exists:
25
return
d
26
else
:
27
msg =
"The directory '%s' does not exist. Please check the username and area (user/group). You may need to create the directory yourself."
% d
28
print
>> sys.stderr, msg
29
raise
NameError(msg)
30
31
def
myCastorBaseDir
():
32
"""Gets the top level directory to use for writing for the current user"""
33
return
castorBaseDir
()
castorBaseDir
Definition:
castorBaseDir.py:1
castorBaseDir.castorBaseDir
def castorBaseDir
Definition:
castorBaseDir.py:16
castorBaseDir.myCastorBaseDir
def myCastorBaseDir
Definition:
castorBaseDir.py:31
castorBaseDir.getUserAndArea
def getUserAndArea
Definition:
castorBaseDir.py:5
Generated for CMSSW Reference Manual by
1.8.5