当前位置: 首页>>代码示例>>Python>>正文


Python Dirac.selectJobs方法代码示例

本文整理汇总了Python中DIRAC.Interfaces.API.Dirac.Dirac.selectJobs方法的典型用法代码示例。如果您正苦于以下问题:Python Dirac.selectJobs方法的具体用法?Python Dirac.selectJobs怎么用?Python Dirac.selectJobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DIRAC.Interfaces.API.Dirac.Dirac的用法示例。


在下文中一共展示了Dirac.selectJobs方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: in

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
group = None
jobs = []
for sw, value in Script.getUnprocessedSwitches():
  if sw in ( 'D', 'Dir' ):
    outputDir = value
  elif sw.lower() in ( 'f', 'file' ):
    if os.path.exists( value ):
      jFile = open( value )
      jobs += jFile.read().split()
      jFile.close()
  elif sw.lower() in ( 'g', 'jobgroup' ):
    group = value
    jobDate = toString( date() - 30 * day )

    # Choose jobs in final state, no more than 30 days old
    result = dirac.selectJobs( jobGroup = value, date = jobDate, status = 'Done' )
    if not result['OK']:
      if not "No jobs selected" in result['Message']:
        print "Error:", result['Message']
        DIRAC.exit( -1 )
    else:
      jobs += result['Value']
    result = dirac.selectJobs( jobGroup = value, date = jobDate, status = 'Failed' )
    if not result['OK']:
      if not "No jobs selected" in result['Message']:
        print "Error:", result['Message']
        DIRAC.exit( -1 )
    else:
      jobs += result['Value']

for arg in parseArguments( args ):
开发者ID:JanEbbing,项目名称:DIRAC,代码行数:33,代码来源:dirac-wms-job-get-output.py

示例2: Dirac

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
selDate = date
if not date:
  selDate = 'Today'
conditions = { 'Status':status,
               'MinorStatus':minorStatus,
               'ApplicationStatus':appStatus,
               'Owner':owner,
               'JobGroup':jobGroup,
               'Date':selDate }

from DIRAC.Interfaces.API.Dirac import Dirac
dirac = Dirac()
result = dirac.selectJobs( status = status,
                           minorStatus = minorStatus,
                           applicationStatus = appStatus,
                           site = site,
                           owner = owner,
                           jobGroup = jobGroup,
                           date = date )
if not result['OK']:
  print 'ERROR %s' % result['Message']
  exitCode = 2
else:
  conds = []
  for n, v in conditions.items():
    if v:
      conds.append( '%s = %s' % ( n, v ) )
  jobs = result['Value']
  constrained = ' '
  if len( jobs ) > 100:
    jobs = jobs[:100]
开发者ID:sbel,项目名称:bes3-jinr,代码行数:33,代码来源:dirac-wms-select-jobs.py

示例3: len

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
exitCode = 0
iKey = "FailureReason"
args = Script.getPositionalArgs()
if len(args):
    iKey = args[0]
print '*INFO* looking for key %s'%iKey
# first, get all jobs which are marked as stalled
status = "Failed"
minor_stat = "Job stalled: pilot not running"
owner = "zimmer"
dirac = Dirac()
jobs = []
conditions = {"Status":status,"MinorStatus":minor_stat,"Owner":owner}
res = dirac.selectJobs( status = status,
                       minorStatus = minor_stat,
                       owner = owner)
if not res['OK']:
    gLogger("ERROR retrieving jobs")
    gLogger(res["Message"])
    exitCode = 2
else:
    conds = []
    for n, v in conditions.items():
        if v:
            conds.append( '%s = %s' % ( n, v ) )
    jobs = res['Value']
pilot_refs = {}
for job in jobs:
    # next get pilot refs
    key = job
开发者ID:Glast,项目名称:GlastDIRAC,代码行数:32,代码来源:dirac-glast-get-stalled-pilot-info.py

示例4: Dirac

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
from DIRAC.Interfaces.API.Dirac  import Dirac, parseArguments
dirac = Dirac()
exitCode = 0

jobs = []
for key, value in Script.getUnprocessedSwitches():
  if key.lower() in ( 'f', 'file' ):
    if os.path.exists( value ):
      jFile = open( value )
      jobs += jFile.read().split()
      jFile.close()
  elif key.lower() in ( 'g', 'jobgroup' ):
    jobDate = toString( date() - 30 * day )
    # Choose jobs no more than 30 days old
    result = dirac.selectJobs( jobGroup = value, date = jobDate )
    if not result['OK']:
      print "Error:", result['Message']
      DIRACExit( -1 )
    jobs += result['Value']

if len( args ) < 1 and not jobs:
  Script.showHelp()

if len( args ) > 0:
  jobs += parseArguments( args )

result = dirac.getJobStatus( jobs )
if result['OK']:
  for job in result['Value']:
    print 'JobID=' + str( job ),
开发者ID:DIRACGrid-test,项目名称:DIRAC,代码行数:32,代码来源:dirac-wms-job-status.py

示例5: Dirac

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
    from DIRAC.Interfaces.API.Dirac import Dirac

    dirac = Dirac()
    exitCode = 0
    errorList = []

    jobs = []
    for sw, value in Script.getUnprocessedSwitches():
        if sw.lower() in ("f", "file"):
            if os.path.exists(value):
                jFile = open(value)
                jobs += jFile.read().split()
                jFile.close()
        elif sw.lower() in ("g", "jobgroup"):
            group = value
            result = dirac.selectJobs(jobGroup=value)
            if not result["OK"]:
                if not "No jobs selected" in result["Message"]:
                    print "Error:", result["Message"]
                    DIRAC.exit(-1)
            else:
                jobs += result["Value"]

    for arg in args:
        jobs.append(arg)

    if not jobs:
        print "Warning: no jobs selected"
        Script.showHelp()
        DIRAC.exit(0)
开发者ID:jemtchou,项目名称:DIRAC,代码行数:32,代码来源:dirac-wms-job-delete.py

示例6: Dirac

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
              'JobGroup': ','.join(str(jg) for jg in jobGroups),
              'Date': selDate}



from DIRAC.Interfaces.API.Dirac import Dirac

dirac = Dirac()
jobs = []

if jobGroups:
  for jobGroup in jobGroups:
    res = dirac.selectJobs(status=status,
                           minorStatus=minorStatus,
                           applicationStatus=appStatus,
                           site=site,
                           owner=owner,
                           jobGroup=jobGroup,
                           date=date,
                           printErrors=False)
    if res['OK']:
      jobs.extend(res['Value'])
    else:
      gLogger.error("Can't select jobs: ", res['Message'])
else:
  res = dirac.selectJobs(status=status,
                         minorStatus=minorStatus,
                         applicationStatus=appStatus,
                         site=site,
                         owner=owner,
                         date=date,
                         printErrors=False)
开发者ID:DIRACGrid,项目名称:DIRAC,代码行数:34,代码来源:dirac-wms-select-jobs.py

示例7: range

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
# ##    ##  ##     ## ##   ### ##   ###  ##  ##   ### ##    ##
# ##     ##  #######  ##    ## ##    ## #### ##    ##  ######

# get jobs from today and yesterday...
days = []
for i in range(2):  # how many days do you want to look back?
    days.append((datetime.date.today() - datetime.timedelta(days=i)).isoformat())

# get list of run_tokens that are currently running / waiting
running_ids = set()
running_names = []
for status in ["Waiting", "Running", "Checking"]:
    for day in days:
        try:
            [running_ids.add(id) for id in dirac.selectJobs(
                status=status, date=day,
                owner=username)['Value']]
        except KeyError:
            pass

n_jobs = len(running_ids)
if n_jobs > 0:
    print("getting names from {} running/waiting jobs... please wait..."
          .format(n_jobs))
    for i, id in enumerate(running_ids):
        if ((100 * i) / n_jobs) % 5 == 0:
            print("\r{} %".format(((20 * i) / n_jobs) * 5)),
        jobname = dirac.attributes(id)["Value"]["JobName"]
        running_names.append(jobname)
    else:
        print("\n... done")
开发者ID:tino-michael,项目名称:tino_cta,代码行数:33,代码来源:submit.py

示例8: range

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
# ##    ##  ##     ## ##   ### ##   ###  ##  ##   ### ##    ##
# ##     ##  #######  ##    ## ##    ## #### ##    ##  ######

# get jobs from today and yesterday...
days = []
for i in range(2):  # how many days do you want to look back?
    days.append((datetime.date.today() - datetime.timedelta(days=i)).isoformat())

# get list of run_tokens that are currently running / waiting
running_ids = set()
running_names = []
for status in ["Waiting", "Running", "Checking"]:
    for day in days:
        try:
            [running_ids.add(id) for id in dirac.selectJobs(
                status=status, date=day,
                owner="tmichael")['Value']]
        except KeyError:
            pass

n_jobs = len(running_ids)
if n_jobs > 0:
    print("getting names from {} running/waiting jobs... please wait..."
          .format(n_jobs))
    for i, id in enumerate(running_ids):
        if ((100 * i) / n_jobs) % 5 == 0:
            print("\r{} %".format(((20 * i) / n_jobs) * 5)),
        jobname = dirac.attributes(id)["Value"]["JobName"]
        running_names.append(jobname)
    else:
        print("\n... done")
开发者ID:jdhp-sap,项目名称:tino_cta,代码行数:33,代码来源:submit.py

示例9: Dirac

# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
selDate = date
if not date:
  selDate = 'Today'
conditions = { 'Status':status,
               'MinorStatus':minorStatus,
               'ApplicationStatus':appStatus,
               'Owner':owner,
               'JobGroup':jobGroup,
               'Date':selDate }

from DIRAC.Interfaces.API.Dirac import Dirac
dirac = Dirac()
result = dirac.selectJobs( Status = status,
                           MinorStatus = minorStatus,
                           ApplicationStatus = appStatus,
                           Site = site,
                           Owner = owner,
                           JobGroup = jobGroup,
                           Date = date )
if not result['OK']:
  print 'ERROR %s' % result['Message']
  exitCode = 2
else:
  conds = []
  for n, v in conditions.items():
    if v:
      conds.append( '%s = %s' % ( n, v ) )
  jobs = result['Value']
  constrained = ' '
  if len( jobs ) > 100:
    jobs = jobs[:100]
开发者ID:KrzysztofCiba,项目名称:DIRAC,代码行数:33,代码来源:dirac-wms-select-jobs.py


注:本文中的DIRAC.Interfaces.API.Dirac.Dirac.selectJobs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。