1 |
paus |
1.1 |
#---------------------------------------------------------------------------------------------------
|
2 |
|
|
# Python Module File to translate storage/computing elements into meta site names
|
3 |
|
|
#
|
4 |
|
|
# Author: C.Paus (Jun 16, 2010)
|
5 |
|
|
#---------------------------------------------------------------------------------------------------
|
6 |
|
|
import os,sys,re,string
|
7 |
|
|
|
8 |
|
|
def convertToUrl(dir,debug):
|
9 |
|
|
if re.search('/castor/cern.ch/', dir):
|
10 |
|
|
storageEle = 'srm-cms.cern.ch'
|
11 |
|
|
storagePath = '/srm/managerv2?SFN='
|
12 |
|
|
elif re.search('/pnfs/cmsaf.mit.edu/', dir):
|
13 |
|
|
storageEle = 'se01.cmsaf.mit.edu'
|
14 |
|
|
storagePath = '/srm/managerv2?SFN='
|
15 |
|
|
elif re.search('/mnt/hadoop/cms/store',dir):
|
16 |
paus |
1.2 |
storageEle = 'se01.cmsaf.mit.edu'
|
17 |
paus |
1.1 |
storagePath = '/srm/v2/server?SFN='
|
18 |
|
|
else:
|
19 |
|
|
storageEle = ''
|
20 |
|
|
storagePath = ''
|
21 |
|
|
|
22 |
|
|
if storageEle == '':
|
23 |
|
|
storageUrl = dir
|
24 |
|
|
else:
|
25 |
|
|
storageUrl = 'srm://' + storageEle + ':8443' + storagePath + dir
|
26 |
|
|
|
27 |
|
|
if debug:
|
28 |
|
|
print " DEBUG (srm.py): " + storageUrl
|
29 |
|
|
|
30 |
|
|
return storageUrl
|