69 |
|
raise CrabException(msg) |
70 |
|
|
71 |
|
self.forced_path = '/store/user/' |
72 |
< |
if self.sched in ['CAF','LSF']: |
73 |
< |
self.protocol = 'direct' |
74 |
< |
self.SE = {'CAF':'caf.cern.ch', 'LSF':''} |
72 |
> |
if self.sched in ['CAF','LSF','PBS']: |
73 |
> |
self.srm_version = 'direct' |
74 |
> |
self.SE = {'CAF':'caf.cern.ch', 'LSF':'', 'PBS':''} |
75 |
|
if self.sched == 'CAF': self.forced_path = '/store/caf/user/' |
76 |
|
|
77 |
|
if not self.usePhedex: |
112 |
|
# python > 2.4 |
113 |
|
# SE = urlparse(url).hostname |
114 |
|
scheme, host, path, params, query, fragment = urlparse(url) |
115 |
< |
SE = host.split(':')[0] |
115 |
> |
# SE = host.split(':')[0] |
116 |
> |
SE = self.getAuthoritativeSE() |
117 |
|
SE_PATH = endpoint.split(host)[1] |
118 |
|
USER = (query.split('user')[1]).split('/')[1] |
119 |
|
else: |
124 |
|
# SE_PATH = endpoint.split(host)[1] |
125 |
|
SE = self.node |
126 |
|
SE_PATH = self.user_se_path + self.user_remote_dir |
127 |
< |
try: |
128 |
< |
USER = (self.lfn.split('user')[1]).split('/')[1] |
129 |
< |
except: |
130 |
< |
pass |
131 |
< |
|
127 |
> |
if self.lfn.find('user'): |
128 |
> |
try: |
129 |
> |
USER = (self.lfn.split('user')[1]).split('/')[1] |
130 |
> |
except: |
131 |
> |
pass |
132 |
> |
if self.lfn.find('group'): |
133 |
> |
try: |
134 |
> |
USER = (self.lfn.split('group')[1]).split('/')[1] |
135 |
> |
except: |
136 |
> |
pass |
137 |
|
return SE, SE_PATH, USER |
138 |
|
|
139 |
|
|
181 |
|
primarydataset = self.publish_data_name |
182 |
|
return primarydataset |
183 |
|
|
184 |
< |
def lfn2pfn(self): |
184 |
> |
def domPhedex(self,params,datasvc_baseUrl): |
185 |
|
""" |
186 |
|
PhEDEx Data Service lfn2pfn call |
187 |
|
|
188 |
< |
input: LFN,node name,protocol |
188 |
> |
input: params,datasvc_baseUrl |
189 |
|
returns: DOM object with the content of the PhEDEx Data Service call |
190 |
|
""" |
185 |
– |
params = {'node' : self.node , 'lfn': self.lfn , 'protocol': self.protocol} |
191 |
|
params = urllib.urlencode(params) |
187 |
– |
datasvc_lfn2pfn="%s/lfn2pfn"%self.datasvc_url |
192 |
|
try: |
193 |
< |
urlresults = urllib.urlopen(datasvc_lfn2pfn, params) |
193 |
> |
urlresults = urllib.urlopen(datasvc_baseUrl, params) |
194 |
|
urlresults = parse(urlresults) |
195 |
|
except IOError: |
196 |
< |
msg="Unable to access PhEDEx Data Service at %s"%datasvc_lfn2pfn |
196 |
> |
msg="Unable to access PhEDEx Data Service at %s"%datasvc_baseUrl |
197 |
|
raise CrabException(msg) |
198 |
|
except: |
199 |
|
urlresults = None |
237 |
|
returns: PFN |
238 |
|
""" |
239 |
|
if self.usePhedex: |
240 |
+ |
params = {'node' : self.node , 'lfn': self.lfn , 'protocol': self.protocol} |
241 |
+ |
datasvc_lfn2pfn="%s/lfn2pfn"%self.datasvc_url |
242 |
|
fullurl="%s/lfn2pfn?node=%s&lfn=%s&protocol=%s"%(self.datasvc_url,self.node,self.lfn,self.protocol) |
243 |
< |
domlfn2pfn = self.lfn2pfn() |
243 |
> |
domlfn2pfn = self.domPhedex(params,datasvc_lfn2pfn) |
244 |
|
if not domlfn2pfn : |
245 |
|
msg="Unable to get info from %s"%fullurl |
246 |
|
raise CrabException(msg) |
259 |
|
msg+=' OriginalSubmission: stageout path is not retrieved from %s \n'%fullurl |
260 |
|
raise CrabException(msg) |
261 |
|
else: |
262 |
< |
if self.sched in ['CAF','LSF'] : |
262 |
> |
if self.sched in ['CAF','LSF','PBS'] : |
263 |
|
stageoutpfn = self.user_se_path+self.lfn |
264 |
|
else: |
265 |
|
stageoutpfn = 'srm://'+self.node+':'+self.user_port+self.user_se_path+self.lfn |
266 |
|
|
267 |
|
return stageoutpfn |
268 |
|
|
269 |
+ |
def getAuthoritativeSE(self): |
270 |
+ |
""" |
271 |
+ |
input: node name |
272 |
+ |
returns: AuthoritativeSE |
273 |
+ |
""" |
274 |
+ |
params = {'node' : self.node } |
275 |
+ |
datasvc_nodes="%s/nodes"%self.datasvc_url |
276 |
+ |
fullurl="%s/nodes/?node=%s"%(self.datasvc_url,self.node) |
277 |
+ |
domnodes = self.domPhedex(params,datasvc_nodes) |
278 |
+ |
|
279 |
+ |
if not domnodes : |
280 |
+ |
msg="Unable to get info from %s"%fullurl |
281 |
+ |
raise CrabException(msg) |
282 |
+ |
|
283 |
+ |
errormsg = self.parse_error(domnodes) |
284 |
+ |
if errormsg: |
285 |
+ |
msg="Error extracting info from %s due to: %s"%(fullurl,errormsg) |
286 |
+ |
raise CrabException(msg) |
287 |
+ |
result = domnodes.getElementsByTagName('phedex') |
288 |
+ |
if not result: |
289 |
+ |
return [] |
290 |
+ |
result = result[0] |
291 |
+ |
se = None |
292 |
+ |
node = result.getElementsByTagName('node') |
293 |
+ |
for m in node: |
294 |
+ |
se=m.getAttribute("se") |
295 |
+ |
if se: |
296 |
+ |
return se |
297 |
|
|
298 |
|
|
299 |
|
if __name__ == '__main__': |