ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/LFNBaseName.py
Revision: 1.3
Committed: Fri Apr 11 14:54:22 2008 UTC (17 years ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_1_pre3, CRAB_2_2_1_pre2, CRAB_2_2_1_pre1, CRAB_2_2_0, CRAB_2_2_0_pre21, CRAB_2_2_0_pre19, CRAB_2_2_0_pre18, CRAB_2_2_0_pre17, CRAB_2_2_0_pre16, CRAB_2_2_0_pre15, CRAB_2_2_0_pre13, CRAB_2_2_0_pre12, CRAB_2_2_0_pre11, CRAB_2_2_0_pre10, bp_osg_bdii, CRAB_2_2_0_pre9, CRAB_2_2_0_pre8, CRAB_2_2_0_pre7
Branch point for: osg_bdii
Changes since 1.2: +1 -1 lines
Log Message:
Many changes to have LSF working with BossLite
Introduce Killer class to handle -kill which works again
Work_space::res() return the correct output directory also in case user has set a non default one, Likewise for logDir()
USER.outputdir is not to be used anywhere outside workspace class
Some cleanup in submit logic, to reduce call of Scheduler specific classes from Submitter.py
crab -clean works as well (well, almost, still need to remove twice the directory)
Fill startDirectory and outputDirectory to Task
GetOuput check status and not schedulerStatus (not stantard)
Some cleanup in the use of BlackWhiteListParser
No explicit check of scheduler concrete type in Submitter at listMatch level: move different behaviour in SchedulerXYZ implementation
Plus other things I'm forgetting...

Stefano

File Contents

# User Rev Content
1 afanfani 1.2 #!/usr/bin/env python
2     """
3     _LFNBaseName_
4     """
5    
6     from crab_exceptions import *
7     from crab_util import runCommand
8     import common
9     import os, string
10    
11    
12     def LFNBase(ProcessedDataset,merged=True):
13     """
14     """
15     lfnbase = "/store"
16     if not merged:
17 slacapra 1.3 lfnbase = os.path.join(lfnbase,"tmp")
18 afanfani 1.2
19     lfnbase = os.path.join(lfnbase, "user", gethnUserName(), ProcessedDataset )
20     return lfnbase
21    
22     def PFNportion(ProcessedDataset):
23     pfnpath = os.path.join(gethnUserName(), ProcessedDataset )
24     return pfnpath
25    
26     def getDN():
27     """
28     extract DN from user proxy's identity
29     """
30     try:
31     userdn = runCommand("voms-proxy-info -identity")
32     userdn = string.strip(userdn)
33     except:
34     msg = "Error. Problem with voms-proxy-info -identity command"
35     raise CrabException(msg)
36     return userdn
37    
38     def gethnUserName():
39     """
40     extract user name from SiteDB
41     """
42     import urllib
43     hnUserName = None
44     userdn = getDN()
45     try:
46     sitedburl="https://cmsweb.cern.ch/sitedb/sitedb/json/index/dnUserName"
47     params = urllib.urlencode({'dn': userdn })
48     f = urllib.urlopen(sitedburl,params)
49     udata = f.read()
50     try:
51     userinfo= eval(udata)
52     except StandardError, ex:
53     msg = "Error. Problem extracting user name from %s : %s"%(sitedburl,ex)
54     raise CrabException(msg)
55     hnUserName = userinfo['user']
56     except:
57     msg = "Error. Problem extracting user name from %s"%sitedburl
58     msg += "Check that you are registered in SiteDB, see https://twiki.cern.ch/twiki/bin/view/CMS/SiteDBForCRAB"
59     raise CrabException(msg)
60     if not hnUserName:
61     msg = "Error. There is no user name associated to DN %s in %s. You need to register in SiteDB with the instructions at https://twiki.cern.ch/twiki/bin/view/CMS/SiteDBForCRAB"%(userdn,sitedburl)
62     print msg
63     raise CrabException(msg)
64     return hnUserName
65    
66     if __name__ == '__main__' :
67     """
68     """
69     from crab_logger import Logger
70     from WorkSpace import *
71     continue_dir="/bohome/fanfani/CRAB"
72     cfg_params={'USER.logdir' : continue_dir }
73     common.work_space = WorkSpace(continue_dir, cfg_params)
74     log = Logger()
75     common.logger = log
76    
77     baselfn = LFNBase("datasetstring")
78     print baselfn
79    
80     unmergedlfn = LFNBase("datasetstring",merged=False)
81     print unmergedlfn
82     print PFNportion("datasetstring")