本文整理汇总了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)
示例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}},
}
示例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)