ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/LFNBaseName.py
(Generate patch)

Comparing COMP/CRAB/python/LFNBaseName.py (file contents):
Revision 1.3 by slacapra, Fri Apr 11 14:54:22 2008 UTC vs.
Revision 1.4 by afanfani, Tue May 27 19:08:17 2008 UTC

# Line 14 | Line 14 | def LFNBase(ProcessedDataset,merged=True
14      """
15      lfnbase = "/store"
16      if not merged:
17 <        lfnbase = os.path.join(lfnbase,"tmp")
18 <    
19 <    lfnbase = os.path.join(lfnbase, "user", gethnUserName(), ProcessedDataset )
17 >        lfnbase = os.path.join(lfnbase,"tmp")  
18 > #    lfnbase = os.path.join(lfnbase, "user", gethnUserName(), ProcessedDataset )
19 >    lfnbase = os.path.join(lfnbase, "user", getUserName(), ProcessedDataset )
20      return lfnbase
21  
22   def PFNportion(ProcessedDataset):
23 <    pfnpath = os.path.join(gethnUserName(), ProcessedDataset )
23 > #    pfnpath = os.path.join(gethnUserName(), ProcessedDataset )
24 >    pfnpath = os.path.join(getUserName(), ProcessedDataset )
25      return pfnpath
26  
27 + def getUnixUserName():
28 +    """
29 +    extract username from whoami
30 +    """
31 +    try:
32 +        UserName = runCommand("whoami")
33 +        UserName = string.strip(UserName)
34 +    except:
35 +        msg = "Error. Problem with whoami command"
36 +        raise CrabException(msg)
37 +    return UserName
38 +
39   def getDN():
40      """
41      extract DN from user proxy's identity
# Line 63 | Line 76 | def gethnUserName():
76          raise CrabException(msg)
77      return hnUserName
78  
79 + def getUserName():
80 +    """
81 +    extract user name from either SiteDB or Unix
82 +    """
83 +    try:
84 +      UserName=gethnUserName()
85 +    except:
86 +      common.logger.message("==> Using as username the Unix user name")
87 +      UserName=getUnixUserName()
88 +    return UserName
89 +
90   if __name__ == '__main__' :
91      """
92      """
93      from crab_logger import Logger
94      from WorkSpace import *
95 <    continue_dir="/bohome/fanfani/CRAB"
95 >    continue_dir="/afs/cern.ch/user/a/afanfani/"
96      cfg_params={'USER.logdir' : continue_dir }
97      common.work_space = WorkSpace(continue_dir, cfg_params)
98      log = Logger()
99      common.logger = log
100  
101 +    print "xx %s xx"%getUserName()
102      baselfn = LFNBase("datasetstring")
103      print baselfn    
104  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines