當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。