本文整理汇总了Python中rucio.client.Client.get_protocols方法的典型用法代码示例。如果您正苦于以下问题:Python Client.get_protocols方法的具体用法?Python Client.get_protocols怎么用?Python Client.get_protocols使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rucio.client.Client
的用法示例。
在下文中一共展示了Client.get_protocols方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: put_data
# 需要导入模块: from rucio.client import Client [as 别名]
# 或者: from rucio.client.Client import get_protocols [as 别名]
def put_data(self, source, destination, fsize=0, fchecksum=0, **pdict):
""" copy output file from disk to local SE """
# function is based on dCacheSiteMover put function
error = PilotErrors()
pilotErrorDiag = ""
# Get input parameters from pdict
lfn = pdict.get('lfn', '')
guid = pdict.get('guid', '')
token = pdict.get('token', '')
scope = pdict.get('scope', '')
dsname = pdict.get('dsname', '')
testLevel = pdict.get('testLevel', '0')
extradirs = pdict.get('extradirs', '')
proxycheck = pdict.get('proxycheck', False)
experiment = pdict.get('experiment', '')
analysisJob = pdict.get('analJob', False)
prodSourceLabel = pdict.get('prodSourceLabel', '')
# get the site information object
si = getSiteInformation(experiment)
tolog("put_data received prodSourceLabel=%s" % (prodSourceLabel))
if prodSourceLabel == 'ddm' and analysisJob:
tolog("Treating PanDA Mover job as a production job during stage-out")
analysisJob = False
# get the DQ2 tracing report
try:
report = pdict['report']
except:
report = {}
else:
# set the proper protocol
report['protocol'] = 'curl'
# mark the relative start
report['catStart'] = time()
# the current file
report['filename'] = lfn
# guid
report['guid'] = guid.replace('-','')
# preparing variables
if fsize == 0 or fchecksum == 0:
ec, pilotErrorDiag, fsize, fchecksum = self.getLocalFileInfo(source, csumtype="adler32")
if ec != 0:
self.__sendReport('LOCAL_FILE_INFO_FAIL', report)
return self.put_data_retfail(ec, pilotErrorDiag)
# now that the file size is known, add it to the tracing report
report['filesize'] = fsize
# get the checksum type
if fchecksum != 0 and fchecksum != "":
csumtype = self.getChecksumType(fchecksum)
else:
csumtype = "default"
# get a proper envsetup
envsetup = self.getEnvsetup()
#if proxycheck:
# s, pilotErrorDiag = self.verifyProxy(envsetup=envsetup, limit=2)
# if s != 0:
# self.__sendReport('NO_PROXY', report)
# return self.put_data_retfail(error.ERR_NOPROXY, pilotErrorDiag)
#else:
# tolog("Proxy verification turned off")
tolog("Proxy verification turned off")
filename = os.path.basename(source)
# get all the proper paths
ec, pilotErrorDiag, tracer_error, dst_gpfn, lfcdir, surl = si.getProperPaths(error, analysisJob, token, prodSourceLabel, dsname, filename, scope=scope)
if ec != 0:
self.__sendReport(tracer_error, report)
return self.put_data_retfail(ec, pilotErrorDiag)
#here begins the new magic... from Vincenzo Lavorini
sitemover = SiteMover.SiteMover()
v_path = sitemover.getPathFromScope(scope, filename)
rucio_c = Client()
if "ATLAS" in token:
token_ok=token[+5:]
else:
token_ok=token
local_se_token=self.site_name+"_"+token_ok
v_hostname= [j['hostname'] for j in rucio_c.get_protocols(local_se_token)]
v_port= [j['port'] for j in rucio_c.get_protocols(local_se_token)]
v_prefix= [j['prefix'] for j in rucio_c.get_protocols(local_se_token)]
v_address= "https://%s:%s%s"%(v_hostname[0],v_port[0],v_prefix[0])
tolog("prova1 address is %s" % (v_address))
if "rucio/" in v_address and "/rucio" in v_path:
v_address=v_address[:-7]
tolog("prova2 address is %s" % (v_address))
elif "rucio" in v_address and "rucio" in v_path :
v_address=v_address[:-6]
tolog("prova3 address is %s" % (v_address))
full_http_surl=v_address+v_path
tolog("prova3 full_http__surl is %s" % (full_http_surl))
#.........这里部分代码省略.........