当前位置: 首页>>代码示例>>Python>>正文


Python Service.__init__方法代码示例

本文整理汇总了Python中WMCore.Services.Service.Service.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Service.__init__方法的具体用法?Python Service.__init__怎么用?Python Service.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WMCore.Services.Service.Service的用法示例。


在下文中一共展示了Service.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
 def __init__(self, dict={}, responseType="xml"):
     """
     responseType will be either xml or json
     """
     self.responseType = responseType.lower()
     
     #if self.responseType == 'json':
         #self.parser = JSONParser()
     #elif self.responseType == 'xml':
         #self.parser = XMLParser()
         
     if os.getenv('WMBS_SERV_CACHE_DIR'):
         dict['cachepath'] = os.getenv('WMBS_SERV_CACHE_DIR') + '/.wmbs_service_cache'
     elif os.getenv('HOME'):
         dict['cachepath'] = os.getenv('HOME') + '/.wmbs_service_cache'
     else:
         dict['cachepath'] = '/tmp/wmbs_service_cache_' + pwd.getpwuid(os.getuid())[0]
     if not os.path.isdir(dict['cachepath']):
         os.mkdir(dict['cachepath'])
     if 'logger' not in dict.keys():
         logging.basicConfig(level=logging.DEBUG,
                 format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                 datefmt='%m-%d %H:%M',
                 filename=dict['cachepath'] + '/wmbs_service.log',
                 filemode='w')
         dict['logger'] = logging.getLogger('WMBSParser')
     
     #TODO if service doesn't need to be authorized, have switch to use Service
     Service.__init__(self, dict)
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:31,代码来源:WMBS.py

示例2: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict = {}, responseType = "json", secure = False):
        """
        responseType will be either xml or json
        """
        self.responseType = responseType.lower()

        dict["timeout"] = 300

        if not dict.has_key('endpoint'):
            dict['endpoint'] = "%scmsweb.cern.ch/phedex/datasvc/%s/prod/" % \
                                ((secure and "https://" or "http://"),
                                 self.responseType)

        if dict.has_key('cachepath'):
            pass
        elif os.getenv('CMS_PHEDEX_CACHE_DIR'):
            dict['cachepath'] = os.getenv('CMS_PHEDEX_CACHE_DIR') + '/.cms_phedexcache'
        elif os.getenv('HOME'):
            dict['cachepath'] = os.getenv('HOME') + '/.cms_phedexcache'
        else:
            dict['cachepath'] = '/tmp/phedex_' + pwd.getpwuid(os.getuid())[0]
        if not os.path.isdir(dict['cachepath']):
            os.makedirs(dict['cachepath'])
        if 'logger' not in dict.keys():
            logging.basicConfig(level = logging.DEBUG,
                    format = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                    datefmt = '%m-%d %H:%M',
                    filename = dict['cachepath'] + '/phedexdbjsonparser.log',
                    filemode = 'w')
            dict['logger'] = logging.getLogger('PhEDExParser')

        Service.__init__(self, dict)
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:34,代码来源:PhEDEx.py

示例3: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict = {}, secure = False):
        """
        responseType will be either xml or json
        """

        if not dict.has_key('endpoint'):
            #TODO needs to change proper default location
            dict['endpoint'] = "%scmssrv49.fnal.gov:8585/reqMgr/" % \
                                ((secure and "https://" or "http://"))
        if dict.has_key('cachepath'):
            pass
        elif os.getenv('REQUESTMGR_CACHE_DIR'):
            dict['cachepath'] = os.getenv('REQUESTMGR_CACHE_DIR') + '/.requestmgr_cache'
        elif os.getenv('HOME'):
            dict['cachepath'] = os.getenv('HOME') + '/.requestmgr_cache'
        else:
            dict['cachepath'] = '/tmp/.requestmgr_' + pwd.getpwuid(os.getuid())[0]
        if not os.path.isdir(dict['cachepath']):
            os.makedirs(dict['cachepath'])
        if 'logger' not in dict.keys():
            logging.basicConfig(level = logging.DEBUG,
                    format = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                    datefmt = '%m-%d %H:%M',
                    filename = dict['cachepath'] + '/jsonparser.log',
                    filemode = 'w')
            dict['logger'] = logging.getLogger('RequestMgrParser')

        dict['accept_type'] = 'text/json'

        Service.__init__(self, dict)
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:32,代码来源:RequestManager.py

示例4: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict = {}):
        """
        """
        dict.setdefault('secure', False)
        if not dict.has_key('endpoint'):
            dict['endpoint'] = "%cmsweb.cern.ch/workqueue/" % \
                                ((dict['secure'] and "https://" or "http://"))
        if dict.has_key('cachepath'):
            pass
        elif os.getenv('WORKQUEUE_CACHE_DIR'):
            dict['cachepath'] = os.getenv('WORKQUEUE_CACHE_DIR') + '/.workqueue_cache'
        elif os.getenv('HOME'):
            dict['cachepath'] = os.getenv('HOME') + '/.workqueue_cache'
        else:
            dict['cachepath'] = '/tmp/.workqueue_' + pwd.getpwuid(os.getuid())[0]
        if not os.path.isdir(dict['cachepath']):
            os.makedirs(dict['cachepath'])
        if 'logger' not in dict.keys():
            logging.basicConfig(level = logging.DEBUG,
                    format = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                    datefmt = '%m-%d %H:%M',
                    filename = dict['cachepath'] + '/jsonparser.log',
                    filemode = 'w')
            dict['logger'] = logging.getLogger('WorkQueueParser')

        dict.setdefault("accept_type", "application/json+thunker")
        dict.setdefault("content_type", "application/json")
        
        self.encoder = JsonWrapper.dumps
        self.decoder = self.jsonThunkerDecoder
        
        Service.__init__(self, dict)
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:34,代码来源:WorkQueue.py

示例5: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, config={}):
        config = dict(config) ### copy dict since mutables are shared between instances
        config['endpoint'] = "https://cmsweb.cern.ch/sitedb/data/prod/"
        config['accept_type'] = "application/json"
        config['content_type'] = "application/json"

        if os.getenv('CMS_SITEDB_CACHE_DIR'):
            config['cachepath'] = os.getenv('CMS_SITEDB_CACHE_DIR') + '/.cms_sitedbcache'
        elif os.getenv('HOME'):
            config['cachepath'] = os.getenv('HOME') + '/.cms_sitedbcache'
        else:
            import pwd
            config['cachepath'] = '/tmp/sitedbjson_' + pwd.getpwuid(os.getuid())[0]

        if not os.path.isdir(config['cachepath']):
            os.mkdir(config['cachepath'])

        if 'logger' not in config.keys():
            logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
                    datefmt='%m-%d %H:%M',
                    filename=config['cachepath'] + '/sitedbjsonparser.log',
                    filemode='w')
            config['logger'] = logging.getLogger('SiteDBParser')

        Service.__init__(self, config)
开发者ID:dmwm,项目名称:WMCore-legacy,代码行数:28,代码来源:SiteDB.py

示例6: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict={}):
        dict['endpoint'] =  dict.get('endpoint', 'https://cmsweb.cern.ch/crabcache/')
        Service.__init__(self, dict)

        if dict.has_key('proxyfilename'):
            #in case there is some code I have not updated in ticket #3780. Should not be required... but...
            self['logger'].warning('The UserFileCache proxyfilename parameter has been replace with the more'
                                   ' general (ckey/cert) pair.')
开发者ID:cinquo,项目名称:WMCore,代码行数:10,代码来源:UserFileCache.py

示例7: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
 def __init__(self, dict={}):
     try:
         Service.__init__(self, dict)
         self["requests"] = SSLRequests(self["requests"]["host"])
          
     except WMException, ex:
         msg = str(ex)
         self["logger"].exception(msg)
         raise WMException(msg)
开发者ID:PerilousApricot,项目名称:CRAB2,代码行数:11,代码来源:SSLService.py

示例8: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, url, logger=None):
        params = {}
        params['endpoint'] = url
        params['cacheduration'] = 0
        params['accept_type'] = 'application/json'
        params['content_type'] = 'application/json'
        params['method'] = 'GET'
        params['logger'] = logger if logger else logging.getLogger()

        Service.__init__(self, params)
开发者ID:amaltaro,项目名称:WMCore,代码行数:12,代码来源:Dashboard.py

示例9: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict={}):
        dict["endpoint"] = dict.get("endpoint", "https://cmsweb.cern.ch/crabcache/")
        Service.__init__(self, dict)

        if dict.has_key("proxyfilename"):
            # in case there is some code I have not updated in ticket #3780. Should not be required... but...
            self["logger"].warning(
                "The UserFileCache proxyfilename parameter has been replace with the more"
                + " general (ckey/cert) pair."
            )
开发者ID:stuartw,项目名称:WMCore,代码行数:12,代码来源:UserFileCache.py

示例10: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict={}):
        dict["endpoint"] = dict.get("endpoint", "https://cmsweb.cern.ch/crabcache/")
        Service.__init__(self, dict)
        self["requests"]["accept_type"] = "application/json"

        if "proxyfilename" in dict:
            # in case there is some code I have not updated in ticket #3780. Should not be required... but...
            self["logger"].warning(
                "The UserFileCache proxyfilename parameter has been replace with the more" " general (ckey/cert) pair."
            )
开发者ID:pietverwilligen,项目名称:WMCore,代码行数:12,代码来源:UserFileCache.py

示例11: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, mydict=None):
        if mydict==None: #dangerous {} default value
            mydict = {}
        mydict['endpoint'] =  mydict.get('endpoint', 'https://cmsweb.cern.ch/crabcache/')
        Service.__init__(self, mydict)
        self['requests']['accept_type'] = 'application/json'

        if 'proxyfilename' in mydict:
            #in case there is some code I have not updated in ticket #3780. Should not be required... but...
            self['logger'].warning('The UserFileCache proxyfilename parameter has been replace with the more'
                                   ' general (ckey/cert) pair.')
开发者ID:BrunoCoimbra,项目名称:WMCore,代码行数:13,代码来源:UserFileCache.py

示例12: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict={}):
        """
        responseType will be JSON
        """

        dict.setdefault("accept_type", "application/json")
        dict.setdefault("content_type", "application/json")
        self.encoder = JsonWrapper.dumps
        self.decoder = JsonWrapper.loads

        Service.__init__(self, dict)
开发者ID:AndresTanasijczuk,项目名称:WMCore,代码行数:13,代码来源:WMAgent.py

示例13: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict={}):
        """
        responseType will be either xml or json
        """

        dict.setdefault("accept_type", "application/json")
        dict.setdefault("content_type", "application/json")
        self.encoder = json.dumps
        self.decoder = json.loads

        Service.__init__(self, dict)
开发者ID:BrunoCoimbra,项目名称:WMCore,代码行数:13,代码来源:WMBS.py

示例14: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict = {}, secure = False):
        """
        responseType will be either xml or json
        """

        if not dict.has_key('endpoint'):
            #TODO needs to change proper default location
            dict['endpoint'] = "%scmssrv49.fnal.gov:8585/reqMgr/" % \
                                ((secure and "https://" or "http://"))

        dict['accept_type'] = 'text/json'
        dict.setdefault('cacheduration', 0)

        Service.__init__(self, dict)
开发者ID:zhiwenuil,项目名称:WMCore,代码行数:16,代码来源:RequestManager.py

示例15: __init__

# 需要导入模块: from WMCore.Services.Service import Service [as 别名]
# 或者: from WMCore.Services.Service.Service import __init__ [as 别名]
    def __init__(self, dict = None, responseType = "json", secure = True):
        """
        responseType will be either xml or json
        """
        if not dict:
            dict = {}
        self.responseType = responseType.lower()

        dict["timeout"] = 300

        if 'endpoint' not in dict:
            dict['endpoint'] = "https://cmsweb.cern.ch/phedex/datasvc/%s/prod/" % self.responseType

        dict.setdefault('cacheduration', 0)
        Service.__init__(self, dict)
开发者ID:AndresTanasijczuk,项目名称:WMCore,代码行数:17,代码来源:PhEDEx.py


注:本文中的WMCore.Services.Service.Service.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。