CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 18 of file castorBaseDir.py.

References getUserAndArea(), and print().

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

Definition at line 7 of file castorBaseDir.py.

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

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

Definition at line 33 of file castorBaseDir.py.

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