當前位置: 首頁>>代碼示例>>Python>>正文


Python Client.getSiteSpecs方法代碼示例

本文整理匯總了Python中pandatools.Client.getSiteSpecs方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.getSiteSpecs方法的具體用法?Python Client.getSiteSpecs怎麽用?Python Client.getSiteSpecs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pandatools.Client的用法示例。


在下文中一共展示了Client.getSiteSpecs方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: convertQueueNameToDQ2Names

# 需要導入模塊: from pandatools import Client [as 別名]
# 或者: from pandatools.Client import getSiteSpecs [as 別名]
  def convertQueueNameToDQ2Names(self, queue, test):
    from pandatools import Client
    from dq2.info.TiersOfATLAS import ToACache
    sites = []

    if 'PFT' in test.template.description:
        #Client.PandaSites = Client.getSiteSpecs('production')[1]
        Client.PandaSites = Client.getSiteSpecs('all')[1]

    for site in Client.PandaSites[queue]['setokens'].values():
      sites.append(Client.convSrmV2ID(site))
    allowed_sites = []
    for site in ToACache.sites:
      if (site not in allowed_sites
          and Client.convSrmV2ID(site) in sites
          and site.find('TAPE') == -1 and 'DISK' in site):
        allowed_sites.append(site)
    return allowed_sites
開發者ID:akanevm,項目名稱:HCCRAB3,代碼行數:20,代碼來源:test_generate.py

示例2: change_site_status

# 需要導入模塊: from pandatools import Client [as 別名]
# 或者: from pandatools.Client import getSiteSpecs [as 別名]
  def change_site_status(self, site, new_status):
    if new_status not in ('test', 'online'):
      return False
    self.add_log('Changing %s status to %s:' % (site, new_status))
    if self.debug:
      self.add_log('DEBUG mode')
      return True
    now = int(time.time())
    if new_status == 'test':
      try:
        last_exclusion = int(Site.objects.filter(name=site)[0].getSiteOptions_for_site.filter(option_name='last_exclusion')[0].option_value)
      except:
        last_exclusion = 0
      if now - last_exclusion < 21600:
        self.add_log('%s was recently auto-excluded. Skipping...' % site)
        return False

    cmd = "curl -s -k --cert $X509_USER_PROXY 'https://panda.cern.ch:25943/server/controller/query?tpmes=setmanual&queue=%s&moduser=HammerCloud&comment=HC.Blacklist.set.manual'" % site
    self.add_log('> ' + cmd)
    if not self.debug:
      o = commands.getoutput(cmd)
      self.add_log(o)
    cmd = "curl -s -k --cert $X509_USER_PROXY 'https://panda.cern.ch:25943/server/controller/query?tpmes=set%s&queue=%s&moduser=HammerCloud&comment=HC.Blacklist.set.%s'" % (new_status, site, new_status)
    self.add_log('> ' + cmd)
    if not self.debug:
      o = commands.getoutput(cmd)
      self.add_log(o)
    if new_status == 'test':
      try:
        option = Site.objects.filter(name=site)[0].getSiteOptions_for_site.filter(option_name='last_exclusion')[0]
        option.option_value = now
      except:
        option = SiteOption()
        option.option_name = 'last_exclusion'
        option.option_value = now
        option.site = Site.objects.get(name=site)
      option.save()

    Client.PandaSites = Client.getSiteSpecs(SITETYPE)[1]
    if not self.debug and Client.PandaSites[site]['status'] != new_status:
      self.store_log('Error setting %s to %s' % (site, new_status), 'error')
      return False
     
    return True
開發者ID:akanevm,項目名稱:HCCRAB3,代碼行數:46,代碼來源:analysis_blacklist.py

示例3: filter_jobs_by_template

# 需要導入模塊: from pandatools import Client [as 別名]
# 或者: from pandatools.Client import getSiteSpecs [as 別名]
import commands
import datetime
import re
import time
import unittest
import sys

from hc.core.utils.hc import cernmail
from hc.atlas.models import Site, Result, SiteOption, Template, TemplateSite, Test, TestLog, BlacklistEvent
from pandatools import Client

SITETYPE = 'production'
Client.PandaSites = Client.getSiteSpecs(SITETYPE)[1]
DEBUG = True

class Policy:
  """Base class for blacklisting policies."""

  def filter_jobs_by_template(self, jobs, template):
    """Filters by template ID."""
    return filter(lambda x: x.test.template.id == template, jobs)

  def evaluate(self, jobs, site, blacklist, failed_templates_target, num_jobs_per_template):
    """Generic evaluator for XFromY templates."""
    if not jobs:
      blacklist.site_has_no_jobs(site)
      return False
    failed_templates = 0
    ids = []
    for t in blacklist.templates:
      template_jobs = self.filter_jobs_by_template(jobs, t)
開發者ID:akanevm,項目名稱:HCCRAB3,代碼行數:33,代碼來源:fake_production_blacklist.py

示例4: VALUES

# 需要導入模塊: from pandatools import Client [as 別名]
# 或者: from pandatools.Client import getSiteSpecs [as 別名]
import re
import sys

sys.path.append('/opt/panda/lib/python2.3/site-packages/')
from pandatools import Client

_SITEMATCH = re.compile('(\S+)_(\S+)')

(e,sitespec) = Client.getSiteSpecs(siteType='all')

for k,v in sitespec.items():
    if v['cloud'] == 'UK':
        sitematch = _SITEMATCH.match(v['ddm'])
        sitename = sitematch.group(1)
        q = '(SELECT id FROM pyf_site WHERE name="%s")' % sitename
        print "INSERT INTO pyf_pandasite (name,site_id) VALUES ('%s', %s);" % (v['sitename'], q)

開發者ID:holzman,項目名稱:apfmon,代碼行數:18,代碼來源:kit-pandasites.py


注:本文中的pandatools.Client.getSiteSpecs方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。