1 from __future__
import print_function
2 from __future__
import absolute_import
7 self.
__pattern=re.compile(
'(^[\w]+)(://)(.+)(/)(.+)')
14 if result
is not None:
15 protocol=result.group(1)
16 if protocol!=
'frontier' and protocol!=
'oracle':
17 raise RuntimeError(
'unsupported technology '+protocol)
22 if self.__servicename.find(
'(')==-1:
23 if self.__servicename.find(
'/')==-1:
25 elif self.__servicename.find(
'/') == -1:
26 self.__servlettotranslate.append(self.__servicename.split(
'(',1)[0])
27 self.__servlettotranslate.append(
'('+self.__servicename.split(
'(',1)[1])
44 """return a list, first is the servlet name, second is whatever additional parameter, if any. 48 if len(parameterDict)==0:
49 raise 'empty frontier parameters, cannot construct full connect string' 51 for k,v
in parameterDict.items():
53 if k==
'load' and v[0][0]==
'balance':
54 result+=
'(loadbalance='+v[0][1]+
')' 56 for (attrname,attrvalue)
in v:
59 fields=attrvalue.rsplit(
'/')
62 attrvalue=
'/'.
join(fields)
63 result+=
'('+k+
'url='+attrvalue+
')' 65 result+=
'('+k+
'='+attrvalue+
')' 68 result+=
'/'+schemaname
70 if __name__ ==
'__main__':
71 from .
import cacheconfigParser
72 o=
'oracle://cms_orcoff_prep/CMS_LUMI_DEV_OFFLINE' 75 print(parser.protocol(),parser.service(),parser.schemaname(),parser.needsitelocalinfo())
77 f1=
'frontier://cmsfrontier.cern.ch:8000/LumiPrep/CMS_LUMI_DEV_OFFLINE' 80 print(parser.protocol(),parser.service(),parser.schemaname(),parser.needsitelocalinfo())
82 f2=
'frontier://(serverurl=cmsfrontier.cern.ch:8000/LumiPrep/CMS_LUMI_DEV_OFFLINE)' 85 print(parser.protocol(),parser.service(),parser.schemaname(),parser.needsitelocalinfo())
87 f3=
'frontier://(proxyurl=http://cmst0frontier.cern.ch:3128)(proxyurl=http://cmst0frontier.cern.ch:3128)(proxyurl=http://cmst0frontier1.cern.ch:3128)(proxyurl=http://cmst0frontier2.cern.ch:3128)(serverurl=http://cmsfrontier.cern.ch:8000/LumiPrep)(serverurl=http://cmsfrontier.cern.ch:8000)/LumiPrep)(serverurl=http://cmsfrontier1.cern.ch:8000/LumiPrep)(serverurl=http://cmsfrontier2.cern.ch:8000/LumiPrep)(serverurl=http://cmsfrontier3.cern.ch:8000/LumiPrep)(serverurl=http://cmsfrontier4.cern.ch:8000/LumiPrep)/CMS_LUMI_DEV_OFFLINE' 90 print(parser.protocol(),parser.service(),parser.schemaname(),parser.needsitelocalinfo())
92 f4=
'frontier://LumiPrep/CMS_LUMI_DEV_OFFLINE' 95 print(parser.protocol(),parser.service(),parser.schemaname(),parser.needsitelocalinfo(),parser.servlettotranslate())
96 if parser.needsitelocalinfo():
97 sitelocalconfig=
'/afs/cern.ch/user/x/xiezhen/w1/site-local-config.xml' 99 frontierparser.parse(sitelocalconfig)
100 print(
'full frontier string')
101 print(parser.fullfrontierStr(parser.schemaname(),frontierparser.parameterdict()))
103 f5=
'frontier://LumiPrep(otherparameter=value)/CMS_LUMI_DEV_OFFLINE' 106 print(parser.protocol(),parser.service(),parser.schemaname(),parser.needsitelocalinfo(),parser.servlettotranslate())
107 print(parser.fullfrontierStr(parser.schemaname(),frontierparser.parameterdict()))
109 f6=
'frontier://LumiCalc/CMS_LUMI_PROD' 112 print(parser.protocol(),parser.service(),parser.schemaname(),parser.needsitelocalinfo(),parser.servlettotranslate())
113 print(parser.fullfrontierStr(parser.schemaname(),frontierparser.parameterdict()))
def needsitelocalinfo(self)
S & print(S &os, JobReport::InputFile const &f)
def __init__(self, connectstr)
static std::string join(char **cmd)
def fullfrontierStr(self, schemaname, parameterDict)
def servlettotranslate(self)