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

Comparing COMP/CRAB/python/PhEDExDatasvcInfo.py (file contents):
Revision 1.8 by spiga, Thu Oct 9 11:23:05 2008 UTC vs.
Revision 1.16 by spiga, Fri Nov 21 14:08:17 2008 UTC

# Line 22 | Line 22 | class PhEDExDatasvcInfo:
22          
23          self.publish_data = cfg_params.get("USER.publish_data",0)
24          self.usenamespace = cfg_params.get("USER.usenamespace",0)
25 <        self.user_remote_dir = cfg_params.get("USER.remote_dir",'')
25 >        self.user_remote_dir = cfg_params.get("USER.user_remote_dir",'')
26          if self.user_remote_dir:
27              if ( self.user_remote_dir[-1] != '/' ) : self.user_remote_dir = self.user_remote_dir + '/'
28              
29          self.datasetpath = cfg_params.get("CMSSW.datasetpath")
30          self.publish_data_name = cfg_params.get('USER.publish_data_name','')
31  
32        self.user_lfn = cfg_params.get("USER.lfn",'')
33        if self.user_lfn:
34            if ( self.user_lfn[-1] != '/' ) : self.user_lfn = self.user_lfn + '/'
35            
32          self.user_port = cfg_params.get("USER.storage_port",'8443')
33          self.user_se_path = cfg_params.get("USER.storage_path",'')
34          if self.user_se_path:
35              if ( self.user_se_path[-1] != '/' ) : self.user_se_path = self.user_se_path + '/'
36                                                      
41      
37          #check if using "private" Storage
38          self.usePhedex = True
39 +        stage_out_faq='https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrabFaq#How_to_store_output_with_CRAB_2'
40 +        if not self.node :
41 +            msg = 'Please specify the storage_element name in your crab.cfg section [USER].\n'
42 +            msg +='      For further information please visit : %s'%stage_out_faq
43 +            raise CrabException(msg)
44          if (self.node.find('T1_') + self.node.find('T2_')+self.node.find('T3_')) == -3: self.usePhedex = False
45 <        if not self.usePhedex and ( self.user_lfn == '' or self.user_se_path == '' ):
45 >        if not self.usePhedex :
46 >             self.user_lfn = cfg_params.get("USER.lfn",'')
47 >             if self.user_lfn:
48 >                 if self.user_remote_dir:
49 >                         msg =  'ERROR: In your crab.cfg you are specifying both lfn and user_remote_dir parameters giving different values. \n'
50 >                         msg += '\t lfn is now deprecated. Please use only user_remote_dir removing lfn from your crab.cfg'
51 >                         raise CrabException(msg)
52 >
53 >        if not self.usePhedex and ( self.user_remote_dir == '' or self.user_se_path == '' ):
54              msg = 'You are asking to stage out without using CMS Storage Name convention. In this case you \n'
55 <            msg += '      must specify both lfn and storage_path in the crab.cfg section [USER].\n '
56 <            msg += '      For further information please visit: ADD_TWIKI_LINK'
55 >            msg += '\t must specify both user_remote_dir and storage_path in the crab.cfg section [USER].\n '
56 >            msg += '\t For further information please visit : %s'%stage_out_faq
57              raise CrabException(msg)
58          self.sched = common.scheduler.name().upper()
59          self.protocol = self.srm_version
60          if self.sched in ['CAF','LSF']:self.protocol = 'direct'
61  
62 +        self.forced_path = '/store/user/'
63 +        if not self.usePhedex:
64 +            self.forced_path = self.user_remote_dir
65          return
66  
67      def getEndpoint(self):  
# Line 78 | Line 89 | class PhEDExDatasvcInfo:
89              if self.protocol == 'direct':
90                  query=endpoint
91                  SE_PATH = endpoint
81                ### FEDE added SE ###
92                  SE = self.sched
93              else:
94                  url = 'http://'+endpoint.split('://')[1]
# Line 90 | Line 100 | class PhEDExDatasvcInfo:
100              USER = (query.split('user')[1]).split('/')[1]
101          else:
102              SE = self.node
103 <            SE_PATH = self.user_se_path + self.user_lfn
103 >            SE_PATH = self.user_se_path + self.user_remote_dir
104              try:
105                  USER = (self.lfn.split('user')[1]).split('/')[1]
106              except:
# Line 110 | Line 120 | class PhEDExDatasvcInfo:
120              ## check if storage_name is a T2 (siteDB query)
121              ## if yes :match self.user_lfn with LFNBaseName...
122              ##     if NOT : raise (you are using a T2. It's not allowed stage out into self.user_path+self.user_lfn)  
123 <            lfn = self.user_lfn
123 >            lfn = self.user_remote_dir
124              return lfn
125          if self.publish_data_name == '' and int(self.publish_data) == 1:
126              msg = "Eeror. The [USER] section does not have 'publish_data_name'"
# Line 120 | Line 130 | class PhEDExDatasvcInfo:
130          if int(self.publish_data) == 1 or int(self.usenamespace) == 1:
131              if self.sched in ['CAF']: l_User=True
132              primaryDataset = self.computePrimaryDataset()
133 <            lfn = LFNBase(primaryDataset,self.publish_data_name,LocalUser=l_User)  + '/${PSETHASH}/'    
133 >            lfn = LFNBase(self.forced_path, primaryDataset, self.publish_data_name, LocalUser=l_User)  + '/${PSETHASH}/'    
134          else:
135              if self.sched in ['CAF','LSF']: l_User=True
136 <            lfn = LFNBase(self.user_remote_dir,LocalUser=l_User)
136 >            lfn = LFNBase(self.forced_path,self.user_remote_dir,LocalUser=l_User)
137          return lfn
138  
139      def computePrimaryDataset(self):
# Line 211 | Line 221 | class PhEDExDatasvcInfo:
221                  msg+='       OriginalSubmission: stageout path is not retrieved from %s \n'%fullurl
222                  raise CrabException(msg)
223          else:
224 <            stageoutpfn = 'srm://'+self.node+':'self.user_port+self.user_se_path+self.lfn
224 >            if self.sched in ['CAF','LSF'] :
225 >                stageoutpfn = self.user_se_path+self.lfn
226 >            else:
227 >                stageoutpfn = 'srm://'+self.node+':'+self.user_port+self.user_se_path+self.lfn
228  
229          return stageoutpfn
230  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines