コード例 #1
0
if len(sys.argv) < 2:
    print("Usage %s <jobName>" % sys.argv[0])
    sys.exit(1)

jobName = sys.argv[1]

finalStatus = ['Done', 'Failed']

dirac = Dirac()

idstr = open("%s/jobIdList.txt" % jobName, 'r').readlines()
ids = map(int, idstr)
print("found %s jobs" % (len(ids)))

res = dirac.getJobSummary(ids)
if not res['OK']:
    print(res['Message'])
    sys.exit(1)

metadata = res['Value']

for jid in ids:
    jobMeta = metadata.get(jid, None)
    if not jobMeta:
        print("No metadata for job ", jid)
        continue

    status = jobMeta['Status']
    print("%s %s" % (jid, status))
    if status in finalStatus:
コード例 #2
0
if len(sys.argv)< 2 :
  print "Usage %s <jobName>"%sys.argv[0]
  sys.exit(1)

jobName = sys.argv[1]

finalStatus = ['Done', 'Failed']

dirac = Dirac()

idstr = open("%s/jobIdList.txt"%jobName, 'r').readlines()
ids = map(int, idstr)
print "found %s jobs"%(len(ids))

res = dirac.getJobSummary(ids)
if not res['OK']:
  print res['Message']
  sys.exit(1)

metadata = res['Value']

for jid in ids:
  jobMeta = metadata.get( jid, None )
  if not jobMeta :
    print "No metadata for job ", jid
    continue

  status = jobMeta['Status']
  print "%s %s" % ( jid, status )
  if status  in finalStatus:
コード例 #3
0
        if "dayspassed" in specialOptions:
            timedelta = local_time-datetime.timedelta(seconds=float(specialOptions["dayspassed"])*3600)
        res = w.getJobs(my_dict,timedelta.strftime( '%Y-%m-%d %H:%M:%S' ))

        if not res['OK']:
            gLogger.error("Could not get list of running jobs.",res['Message'])
            dexit(1)
        job_list = res['Value']
    else:
        job_list = specialOptions["JobID"].split(",")
        doLogging = True
    status = {}
    sites = {} 

    for chunk in breakListIntoChunks(job_list,1000):
        res = d.getJobSummary(chunk)   
        if not res['OK']:
            gLogger.error("Could not get status of job list chunk,",res['Message'])
            if do_xml:
                d.exit(1)            
            continue
        status.update(res['Value'])
    # get sites info
        res = w.getJobsSites(chunk)
        if not res['OK']:
            gLogger.error("Could not get sites;",res['Message'])
        sites.update(res['Value'])
    
    if not do_xml:
        print('# ID\thostname\tStatus\tSubmitted\tStarted\tEnded\tCPUtime\tMemory')
コード例 #4
0
    status_dict, sites_dict = tool_box.parse_jobs_list(jobs_list)

    # print out my favourite tables
    Script.gLogger.notice(
        "%16s\tWaiting\tRunning\tFailed\tStalled\tDone\tTotal" %
        "Site")
    for key, val in sites_dict.items():
        txt = "%16s\t%s\t%s\t%s\t%s\t%s\t%s" %\
            (key.split('LCG.')[-1], val['Waiting'], val['Running'], val['Failed'],
             val['Stalled'], val['Done'], val['Total'])
        if float(val['Done']) > 0.:
            # More than 10% crash, print bold red
            if float(val['Failed']) / float(val['Done']) > 0.1:
                txt = highlight(txt)
        Script.gLogger.notice(txt)

    Script.gLogger.notice("%16s\t%s\t%s\t%s\t%s\t%s\t%s" %
                          ('Total', status_dict['Waiting'], status_dict['Running'],
                           status_dict['Failed'], status_dict['Stalled'],
                           status_dict['Done'], status_dict['Total']))

    # print failed
    SaveFailed = False
    if SaveFailed:
        txt = ''
        for job in jobs_list:
            majstatus = status['Value'][int(job)]['Status']
            if majstatus == "Failed":
                txt += str(dirac.getJobSummary(int(job))) + '\n'
        open('failed.txt', 'w').write(txt)
コード例 #5
0
                seconds=float(specialOptions["dayspassed"]) * 3600)
        res = w.getJobs(my_dict, timedelta.strftime('%Y-%m-%d %H:%M:%S'))

        if not res['OK']:
            gLogger.error("Could not get list of running jobs.",
                          res['Message'])
            dexit(1)
        job_list = res['Value']
    else:
        job_list = specialOptions["JobID"].split(",")
        doLogging = True
    status = {}
    sites = {}

    for chunk in breakListIntoChunks(job_list, 1000):
        res = d.getJobSummary(chunk)
        if not res['OK']:
            gLogger.error("Could not get status of job list chunk,",
                          res['Message'])
            if do_xml:
                d.exit(1)
            continue
        status.update(res['Value'])
        # get sites info
        res = w.getJobsSites(chunk)
        if not res['OK']:
            gLogger.error("Could not get sites;", res['Message'])
        sites.update(res['Value'])

    if not do_xml:
        print(
コード例 #6
0
#!/bin/env python

import sys

from DIRAC.Core.Base import Script
Script.parseCommandLine()

from DIRAC.Interfaces.API.Job import Job
from DIRAC.Interfaces.API.Dirac import Dirac

dirac = Dirac()
jobid = sys.argv[1]

print dirac.status(jobid)

summary_file = str(jobid) + "_summary.txt"
dirac.getJobSummary(jobid, outputFile=summary_file, printOutput=True)

print dirac.getJobDebugOutput(jobid)

print dirac.getJobLoggingInfo(jobid, printOutput=False)