5 |
|
from WorkSpace import * |
6 |
|
from urlparse import urlparse |
7 |
|
from LFNBaseName import * |
8 |
+ |
from crab_util import getUserName |
9 |
|
|
10 |
|
class PhEDExDatasvcInfo: |
11 |
|
def __init__( self , cfg_params=None, config=None ): |
14 |
|
self.datasvc_url="https://cmsweb.cern.ch/phedex/datasvc/xml/prod" |
15 |
|
|
16 |
|
self.FacOps_savannah = 'https://savannah.cern.ch/support/?func=additem&group=cmscompinfrasup' |
17 |
< |
stage_out_faq='https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrabHowTo#Stageout_and_publication' |
17 |
> |
self.stage_out_faq='https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrabHowTo#Stageout_and_publication' |
18 |
|
self.dataPub_faq = 'https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrabForPublication' |
19 |
|
|
20 |
|
self.usePhedex = True |
59 |
|
#check if using "private" Storage |
60 |
|
if not self.node : |
61 |
|
msg = 'Please specify the storage_element name in your crab.cfg section [USER].\n' |
62 |
< |
msg +='\tFor further information please visit : %s'%stage_out_faq |
62 |
> |
msg +='\tFor further information please visit : %s'%self.stage_out_faq |
63 |
|
raise CrabException(msg) |
64 |
|
if (self.node.find('T1_') + self.node.find('T2_')+self.node.find('T3_')) == -3: self.usePhedex = False |
65 |
|
|
66 |
|
if not self.usePhedex and ( self.user_remote_dir == '' or self.user_se_path == '' ): |
67 |
|
msg = 'You are asking to stage out without using CMS Storage Name convention. In this case you \n' |
68 |
|
msg += '\t must specify both user_remote_dir and storage_path in the crab.cfg section [USER].\n ' |
69 |
< |
msg += '\t For further information please visit : \n\t%s'%stage_out_faq |
69 |
> |
msg += '\t For further information please visit : \n\t%s'%self.stage_out_faq |
70 |
|
raise CrabException(msg) |
71 |
|
|
72 |
|
self.forced_path = '/store/user/' |
87 |
|
|
88 |
|
#extract the PFN for the given node,LFN,protocol |
89 |
|
endpoint = self.getStageoutPFN() |
89 |
– |
### FEDE added a check for the final / |
90 |
|
if ( endpoint[-1] != '/' ) : endpoint = endpoint + '/' |
91 |
– |
###################################### |
91 |
|
|
92 |
|
#extract SE name an SE_PATH (needed for publication) |
93 |
|
SE, SE_PATH, User = self.splitEndpoint(endpoint) |
108 |
|
SE = self.SE[self.sched] |
109 |
|
else: |
110 |
|
url = 'http://'+endpoint.split('://')[1] |
112 |
– |
# python > 2.4 |
113 |
– |
# SE = urlparse(url).hostname |
111 |
|
scheme, host, path, params, query, fragment = urlparse(url) |
115 |
– |
# SE = host.split(':')[0] |
112 |
|
SE = self.getAuthoritativeSE() |
113 |
|
SE_PATH = endpoint.split(host)[1] |
114 |
< |
USER = (query.split('user')[1]).split('/')[1] |
114 |
> |
### fede ### |
115 |
> |
#USER = (query.split('user')[1]).split('/')[1] |
116 |
|
else: |
117 |
< |
#### to test ##### |
117 |
> |
#### to test ##### |
118 |
|
# url = 'http://'+endpoint.split('://')[1] |
119 |
|
# scheme, host, path, params, query, fragment = urlparse(url) |
120 |
|
# SE = host.split(':')[0] |
121 |
|
# SE_PATH = endpoint.split(host)[1] |
122 |
|
SE = self.node |
123 |
|
SE_PATH = self.user_se_path + self.user_remote_dir |
124 |
< |
if self.lfn.find('user'): |
125 |
< |
try: |
126 |
< |
USER = (self.lfn.split('user')[1]).split('/')[1] |
127 |
< |
except: |
128 |
< |
pass |
129 |
< |
if self.lfn.find('group'): |
130 |
< |
try: |
131 |
< |
USER = (self.lfn.split('group')[1]).split('/')[1] |
132 |
< |
except: |
133 |
< |
pass |
124 |
> |
### fede ### |
125 |
> |
#if self.lfn.find('user'): |
126 |
> |
# try: |
127 |
> |
# USER = (self.lfn.split('user')[1]).split('/')[1] |
128 |
> |
# except: |
129 |
> |
# pass |
130 |
> |
### fede ### |
131 |
> |
if self.lfn.find('group') != -1: |
132 |
> |
try: |
133 |
> |
USER = (self.lfn.split('group')[1]).split('/')[1] |
134 |
> |
except: |
135 |
> |
pass |
136 |
> |
else: |
137 |
> |
USER = getUserName() |
138 |
|
return SE, SE_PATH, USER |
139 |
|
|
140 |
|
|
170 |
|
else: |
171 |
|
if self.sched in ['CAF','LSF']: l_User=True |
172 |
|
lfn = LFNBase(self.forced_path,self.user_remote_dir) |
173 |
+ |
if ( lfn[-1] != '/' ) : lfn = lfn + '/' |
174 |
|
return lfn |
175 |
|
|
176 |
|
def computePrimaryDataset(self): |
266 |
|
else: |
267 |
|
stageoutpfn = 'srm://'+self.node+':'+self.user_port+self.user_se_path+self.lfn |
268 |
|
|
269 |
+ |
if ( stageoutpfn[-1] != '/' ) : stageoutpfn = stageoutpfn + '/' |
270 |
|
return stageoutpfn |
271 |
|
|
272 |
|
def getAuthoritativeSE(self): |