本文整理汇总了Python中pandatools.Client._x509方法的典型用法代码示例。如果您正苦于以下问题:Python Client._x509方法的具体用法?Python Client._x509怎么用?Python Client._x509使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandatools.Client
的用法示例。
在下文中一共展示了Client._x509方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_pick_dataset
# 需要导入模块: from pandatools import Client [as 别名]
# 或者: from pandatools.Client import _x509 [as 别名]
def get_pick_dataset(self, verbose=False):
job = self._getParent()
if job and job.inputdata and job.inputdata.pick_event_list.name != '' and len(job.inputdata.dataset) !=0 :
raise ApplicationConfigurationError('Cannot use event pick list and input dataset at the same time.')
#parametr check for event picking
if job and job.inputdata and job.inputdata.pick_event_list.name != '':
if job.inputdata.pick_data_type == '':
raise ApplicationConfigurationError('Event pick data type (pick_data_type) must be specified.')
# set X509_USER_PROXY
from pandatools import Client
if 'X509_USER_PROXY' not in os.environ or os.environ['X509_USER_PROXY'] == '':
os.environ['X509_USER_PROXY'] = Client._x509()
# setup eventLookup
from pandatools.eventLookupClient import eventLookupClient
elssiIF = eventLookupClient()
# open run/event txt
runEvtList = []
if os.path.exists( self.pick_event_list.name ):
logger.info("Event pick list file %s selected" % self.pick_event_list.name)
runevttxt = open(self.pick_event_list.name)
for line in runevttxt:
items = line.split()
if len(items) != 2:
continue
runNr,evtNr = items
runEvtList.append([runNr,evtNr])
# close
runevttxt.close()
else:
raise ApplicationConfigurationError('Could not read event pick list file %s.' %self.pick_event_list.name)
# convert self.pick_data_type to Athena stream ref
if self.pick_data_type == 'AOD':
streamRef = 'StreamAOD_ref'
elif self.pick_data_type == 'ESD':
streamRef = 'StreamESD_ref'
elif self.pick_data_type == 'RAW':
streamRef = 'StreamRAW_ref'
else:
errStr = 'invalid data type %s for event picking. ' % self.pick_data_type
errStr += ' Must be one of AOD,ESD,RAW'
raise ApplicationConfigurationError(errStr)
logger.info('Getting dataset names and LFNs from ELSSI for event picking')
# read
guids = []
guidRunEvtMap = {}
runEvtGuidMap = {}
# bulk lookup
nEventsPerLoop = 500
iEventsTotal = 0
while iEventsTotal < len(runEvtList):
tmpRunEvtList = runEvtList[iEventsTotal:iEventsTotal+nEventsPerLoop]
iEventsTotal += nEventsPerLoop
paramStr = 'Run, Evt: %s, Stream: %s, Dataset pattern: %s' % (tmpRunEvtList,self.pick_stream_name, self.pick_dataset_pattern)
logger.debug(paramStr)
logger.info('.')
# check with ELSSI
if self.pick_stream_name == '':
guidListELSSI = elssiIF.doLookup(tmpRunEvtList,tokens=streamRef,amitag=self.event_pick_amitag,extract=True)
else:
guidListELSSI = elssiIF.doLookup(tmpRunEvtList,stream=self.pick_stream_name,tokens=streamRef,amitag=self.event_pick_amitag,extract=True)
if len(guidListELSSI) == 0 or guidListELSSI == None:
errStr = ''
for tmpLine in elssiIF.output:
errStr += tmpLine + '\n'
errStr = "GUID was not found in ELSSI.\n" + errStr
raise ApplicationConfigurationError(errStr)
# check attribute
attrNames, attrVals = guidListELSSI
def getAttributeIndex(attr):
for tmpIdx,tmpAttrName in enumerate(attrNames):
if tmpAttrName.strip() == attr:
return tmpIdx
errStr = "cannot find attribute=%s in %s provided by ELSSI" % (attr,str(attrNames))
raise ApplicationConfigurationError(errStr)
# get index
indexEvt = getAttributeIndex('EventNumber')
indexRun = getAttributeIndex('RunNumber')
indexTag = getAttributeIndex(streamRef)
# check events
for runNr,evtNr in tmpRunEvtList:
paramStr = 'Run:%s Evt:%s Stream:%s' % (runNr,evtNr,self.pick_stream_name)
# collect GUIDs
tmpguids = []
for attrVal in attrVals:
if runNr == attrVal[indexRun] and evtNr == attrVal[indexEvt]:
tmpGuid = attrVal[indexTag]
# check non existing
if tmpGuid == 'NOATTRIB':
continue
if not tmpGuid in tmpguids:
tmpguids.append(tmpGuid)
#.........这里部分代码省略.........