CMS 3D CMS Logo

Functions
castorBaseDir Namespace Reference

Functions

def castorBaseDir (user=os.environ['USER'], area=None)
 
def getUserAndArea (user)
 
def myCastorBaseDir ()
 

Function Documentation

◆ castorBaseDir()

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

◆ getUserAndArea()

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 def getUserAndArea(user):
8  """Factor out the magic user hack for use in other classes"""
9 
10  area = 'user'
11 
12  tokens = user.split('_')
13  if tokens and len(tokens) > 1:
14  user = tokens[0]
15  area = tokens[1]
16  return user, area
17 
def getUserAndArea(user)
Definition: castorBaseDir.py:7

◆ myCastorBaseDir()

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 def myCastorBaseDir():
34  """Gets the top level directory to use for writing for the current user"""
35  return castorBaseDir()