Exemple #1
0
def add_Job(system, a_job):
    if system.job_set.filter(acct_id=int(a_job.id)):
        print "Job %s already exists" % a_job.id
        return
    owner = get_user(a_job.acct['account'], system)
    #nr_bad_hosts = len(filter(lambda h: len(h.times) < 2,
    #                          a_job.hosts.values()))
    job_dict = {
        'system': system,
        'acct_id': a_job.id,
        'owner': owner,
        'queue': a_job.acct['queue'],
        'queue_wait_time': a_job.start_time - a_job.acct['submission_time'],
        'begin': a_job.start_time,
        'end': a_job.end_time,
        #'nr_bad_hots': nr_bad_hosts,
        'nr_slots': a_job.acct['slots'],
        'pe': a_job.acct['granted_pe'],
        'failed': a_job.acct['failed'],
        'exit_status': a_job.acct['exit_status'],
    }
    job_dict.update(job.JobAggregator(a_job).stats)
    #newJob.nr_hosts = len(a_job.hosts)
    try:
        newJob = tsm_Job(**job_dict)
        newJob.save()
    except DatabaseError:
        print "Error on job,", a_job.id
        transaction.rollback()
        return
    hosts = map(lambda node: get_node(system, node), a_job.hosts.keys())
    newJob.hosts = hosts

    print "Added job:", a_job.id
Exemple #2
0
def updateDatabase(system,a_job):
 if system.job_set.filter(acct_id=int(a_job.id)):
  print "Job %s already exists" % a_job.id
  return
 owner = get_user(a_job.acct['account'], system)
 #nr_bad_hosts = len(filter(lambda h: len(h.times) < 2,
 #                          a_job.hosts.values()))
 job_dict = {
  'system': system,
  'acct_id': a_job.id,
  'owner': owner,
  'queue': a_job.acct['queue'],
  'queue_wait_time': a_job.start_time - a_job.acct['submission_time'],
  'begin': a_job.start_time,
  'end': a_job.end_time,
  #'nr_bad_hots': nr_bad_hosts,
  'nr_slots': a_job.acct['slots'],
  'pe': a_job.acct['granted_pe'],
  'failed': a_job.acct['failed'],
  'exit_status': a_job.acct['exit_status'],
 }
 job_dict.update(job.JobAggregator(a_job).stats)
 #newJob.nr_hosts = len(a_job.hosts)
 try:
  newJob = tsm_Job(**job_dict)
  newJob.save()
 except DatabaseError,TypeError:
  print "Error on job,", a_job.id
  transaction.rollback()
  return
Exemple #3
0
def add_Job(system, a_job):
    if system.job_set.filter(acct_id=int(a_job.id)):
        print "Job %s already exists" % a_job.id
        return
    owner = get_user(a_job.acct['account'], system)

    job_dict = {
        'system': system,
        'acct_id': a_job.id,
        'owner': owner,
        'begin': a_job.start_time,
        'end': a_job.end_time,
        'nr_slots': a_job.acct['slots'],
        'pe': a_job.acct['granted_pe'],
        'failed': a_job.acct['failed'],
        'exit_status': a_job.acct['exit_status'],
    }
    #newJob.nr_hosts = len(a_job.hosts)
    newJob = tsm_Job(**job_dict)
    newJob.save()
    hosts = map(lambda node: get_node(system, node), a_job.hosts.keys())
    newJob.hosts = hosts

    print "Added job:", a_job.id
Exemple #4
0
def add_Job(system, a_job):
    if system.job_set.filter(acct_id=int(a_job.id)):
        print "Job %s already exists" % a_job.id
        return
    owner = get_user(a_job.acct['owner'], system)

    flops = NP.zeros(a_job.times.size)
    total_flops = NP.array([])
    mem_total_per_host = NP.array([])

    for a_host in a_job.hosts:
        a_host = a_job.hosts[a_host]
        for k,v in a_host.interpret_amd64_pmc_cpu().iteritems():
            if 'SSEFLOPS' in v:
                flops += v['SSEFLOPS']

        index = a_job.schema['mem'].keys['MemUsed'].index
        
        mem_total = NP.zeros(a_job.times.size)

        for v in a_host.stats['mem']:
            mem_total += a_host.stats['mem'][v][:,2]

        mem_total_per_host = NP.append(mem_total, mem_total_per_host)

        total_flops = NP.append(total_flops, NP.diff(flops) / NP.diff(a_job.times) / 10 ** 9)
        avg_flops = total_flops.mean()


    flops_25 = NP.count_nonzero([total_flops < FLOPS_25])*100 /total_flops.size
    flops_50 = NP.count_nonzero([total_flops < FLOPS_50])*100 /total_flops.size
    flops_75 = NP.count_nonzero([total_flops < FLOPS_75])*100 /total_flops.size

    mem_25 = NP.count_nonzero([mem_total_per_host < MEM_25])*100 / mem_total_per_host.size
    mem_50 = NP.count_nonzero([mem_total_per_host < MEM_50])*100 / mem_total_per_host.size
    mem_75 = NP.count_nonzero([mem_total_per_host < MEM_75])*100 / mem_total_per_host.size
 

 
    #nr_bad_hosts = len(filter(lambda h: len(h.times) < 2,
    #                          a_job.hosts.values()))
    job_dict = {
        'system': system,
        'acct_id': a_job.id,
        'owner': owner,
        'queue': a_job.acct['queue'],
        'queue_wait_time': a_job.start_time - a_job.acct['submission_time'],
        'begin': a_job.start_time,
        'end': a_job.end_time,
        #'nr_bad_hots': nr_bad_hosts,
        'nr_slots': a_job.acct['slots'],
        'pe': a_job.acct['granted_pe'],
        'failed': a_job.acct['failed'],
        'exit_status': a_job.acct['exit_status'],
        'avg_flops': avg_flops,
        'flops_25': flops_25,
        'flops_50': flops_50,
        'flops_75': flops_75,
        'mem_25': mem_25,
        'mem_50': mem_50,
        'mem_75': mem_75,
    }
    job_dict.update(job.JobAggregator(a_job).stats)
    #newJob.nr_hosts = len(a_job.hosts)
    try:
        newJob = tsm_Job(**job_dict)
        newJob.save()
    except DatabaseError:
        print "Error on job,", a_job.id
        transaction.rollback()
        return
    hosts = map(lambda node: get_node(system, node), a_job.hosts.keys())
    newJob.hosts = hosts

    print "Added job:", a_job.id