本文整理匯總了Python中pandatools.Client.convertDQ2toPandaID方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.convertDQ2toPandaID方法的具體用法?Python Client.convertDQ2toPandaID怎麽用?Python Client.convertDQ2toPandaID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandatools.Client
的用法示例。
在下文中一共展示了Client.convertDQ2toPandaID方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: expandExcludedSiteList
# 需要導入模塊: from pandatools import Client [as 別名]
# 或者: from pandatools.Client import convertDQ2toPandaID [as 別名]
def expandExcludedSiteList( job ):
'''Expand a site list taking wildcards into account'''
# first, check if there's anything to be done
check_ddm = False
wildcard = False
excl_sites = []
for s in job.backend.requirements.excluded_sites:
if s.find("ANALY_") == -1:
check_ddm = True
if s.find("*") != -1:
wildcard = True
if s.find("ANALY_") != -1 and s.find("*") == -1:
excl_sites.append(s)
if not check_ddm and not wildcard:
return excl_sites
# we have either wildcards or DDM sites listed
# First, find the allowed sites for this job and ensure no duplicates anywhere
from pandatools import Client
logger.info("Excluding DDM and wildcarded sites from Jedi job. Please wait....")
orig_ddm_list = []
new_ddm_list = []
for s in job.inputdata.get_locations():
if not s in orig_ddm_list:
orig_ddm_list.append(s)
new_ddm_list.append(s)
orig_panda_list = []
for s in [Client.convertDQ2toPandaID(x) for x in new_ddm_list]:
for s2 in Client.PandaSites.keys():
if s2.find(s) != -1 and not s2 in orig_panda_list:
orig_panda_list.append(s2)
if check_ddm:
# remove any DDM sites that are referenced, including wildcards
for s in job.backend.requirements.excluded_sites:
if s in orig_ddm_list:
new_ddm_list.remove(s)
if s.find("*") != -1:
for s2 in orig_ddm_list:
if fnmatch.fnmatch(s2, s):
new_ddm_list.remove(s2)
# now recreate the panda list and see if any have been dropped
new_panda_list = []
for s in [Client.convertDQ2toPandaID(x) for x in new_ddm_list]:
for s2 in Client.PandaSites.keys():
if s2.find(s) != -1 and not s2 in new_panda_list:
new_panda_list.append(s)
for s in orig_panda_list:
if not s in new_panda_list and not s in excl_sites:
excl_sites.append(s)
if wildcard:
# find wilcarded ANALY_* sites and exclude any that match good sites
for s in job.backend.requirements.excluded_sites:
if s.find("*") != -1:
for s2 in orig_panda_list:
if fnmatch.fnmatch(s2, s) and not s2 in excl_sites:
excl_sites.append(s2)
return excl_sites