test
CMS 3D CMS Logo

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

Functions

def castorBaseDir
 
def getUserAndArea
 
def myCastorBaseDir
 

Function Documentation

def castorBaseDir.castorBaseDir (   user = os.environ['USER'],
  area = None 
)
Gets the top level directory to use for writing for 'user'

Definition at line 16 of file castorBaseDir.py.

References getUserAndArea().

16 
17 def castorBaseDir( user=os.environ['USER'], area = None):
18  """Gets the top level directory to use for writing for 'user'"""
19 
20  if area is None:
21  user, area = getUserAndArea(user)
22 
23  d = 'root://eoscms.cern.ch//eos/cms/store/cmst3/%s/%s/CMG' % (area,user)
24  exists = castortools.isDirectory( castortools.lfnToCastor(d) )
25  if exists:
26  return d
27  else:
28  msg = "The directory '%s' does not exist. Please check the username and area (user/group). You may need to create the directory yourself." % d
29  print >> sys.stderr, msg
30  raise NameError(msg)
def castorBaseDir.getUserAndArea (   user)
Factor out the magic user hack for use in other classes

Definition at line 5 of file castorBaseDir.py.

Referenced by addToDatasets.addToDatasets(), and castorBaseDir().

5 
6 def getUserAndArea(user):
7  """Factor out the magic user hack for use in other classes"""
8 
9  area = 'user'
10 
11  tokens = user.split('_')
12  if tokens and len(tokens) > 1:
13  user = tokens[0]
14  area = tokens[1]
15  return user, area
def castorBaseDir.myCastorBaseDir ( )
Gets the top level directory to use for writing for the current user

Definition at line 31 of file castorBaseDir.py.

31 
32 def myCastorBaseDir():
33  """Gets the top level directory to use for writing for the current user"""
34  return castorBaseDir()