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


Python Client.add_protocol方法代码示例

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


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

示例1: open

# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import add_protocol [as 别名]
import json
import sys
import traceback
from rucio.common.exception import Duplicate
from rucio.client import Client
rse_repo_file ='/opt/rucio/etc/rse_repository.json'

json_data = open(rse_repo_file)
repo_data = json.load(json_data)
json_data.close()
c = Client()
for rse in repo_data:
    for p_id in repo_data[rse]['protocols']['supported']:
        try:
            print rse, p_id, repo_data[rse]['protocols']['supported'][p_id]
            c.add_protocol(rse, p_id, params=repo_data[rse]['protocols']['supported'][p_id])
#            c.add_protocol(rse, p_id)
        except ValueError, e:
            print rse, e
        except Duplicate, e:
            continue
        except KeyError:
            continue
        except Exception, e:
            errno, errstr = sys.exc_info()[:2]
            trcbck = traceback.format_exc()
            print 'Interrupted processing for %s with %s %s %s.' % (rse, errno, errstr, trcbck)
开发者ID:ChengHsi,项目名称:rucyio,代码行数:29,代码来源:rse_sync.py

示例2: locals

# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import add_protocol [as 别名]
 for rse in repo_data:
     try:
         deterministic = repo_data[rse].get("deterministic", True)
         volatile = repo_data[rse].get("volatile", False)
         c.add_rse(rse, deterministic=deterministic, volatile=volatile)
     except Duplicate:
         print "%(rse)s already added" % locals()
     except:
         errno, errstr = sys.exc_info()[:2]
         trcbck = traceback.format_exc()
         print "Interrupted processing with %s %s %s." % (errno, errstr, trcbck)
     rses_total -= 1
     for p_id in repo_data[rse]["protocols"]["supported"]:
         try:
             repo_data[rse]["protocols"]["supported"][p_id].update({"scheme": p_id})
             c.add_protocol(rse, repo_data[rse]["protocols"]["supported"][p_id])
         except Duplicate:
             pass
         except Exception:
             errno, errstr = sys.exc_info()[:2]
             trcbck = traceback.format_exc()
             print "Interrupted processing with %s %s %s." % (errno, errstr, trcbck)
             sys.exit(CRITICAL)
 print "1. Importing RSE repository file finished."
 # 2. Fill up th DB wo 130 sites with an avg. 6 protocols per site
 protocol = {
     "impl": "rucio.rse.protocols.mock.Default",
     "hostame": "rucio.cern.ch" % uuid(),
     "port": 42,
     "domains": {"LAN": {"read": 1, "write": 1, "delete": 1}, "WAN": {"read": 1, "write": 1, "delete": 1}},
 }
开发者ID:pombredanne,项目名称:rucio,代码行数:33,代码来源:bootstrap_stresstest.py

示例3: locals

# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import add_protocol [as 别名]
            deterministic = repo_data[rse].get('deterministic', True)
            volatile = repo_data[rse].get('volatile', False)
            region_code = repo_data[rse].get('region_code')
            country_name = repo_data[rse].get('country_name')
            staging_area = repo_data[rse].get('staging_area')
            continent = repo_data[rse].get('continent')
            time_zone = repo_data[rse].get('time_zone')
            ISP = repo_data[rse].get('ISP')
            c.add_rse(rse, deterministic=deterministic, volatile=volatile,
                      region_code=region_code, country_name=country_name, staging_area=staging_area,
                      continent=continent, time_zone=time_zone, ISP=ISP)
        except Duplicate:
            print '%(rse)s already added' % locals()
        except:
            errno, errstr = sys.exc_info()[:2]
            trcbck = traceback.format_exc()
            print 'Interrupted processing with %s %s %s.' % (errno, errstr, trcbck)
        for p_id in repo_data[rse]['protocols']['supported']:
            try:
                p = repo_data[rse]['protocols']['supported'][p_id]
                p['scheme'] = p_id
                c.add_protocol(rse, p)
            except ValueError, e:
                print rse, e
            except Duplicate, e:
                print rse, e
            except Exception, e:
                errno, errstr = sys.exc_info()[:2]
                trcbck = traceback.format_exc()
                print 'Interrupted processing for %s with %s %s %s.' % (rse, errno, errstr, trcbck)
开发者ID:pombredanne,项目名称:rucio,代码行数:32,代码来源:sync_rses.py


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