Exemplo n.º 1
0
def display_list(lis, **kwargs):
    id_dict = {}
    for arg in lis:
        if type(arg) is Report or type(arg) is job_stats.Job:
            pass
        elif str(arg).isdigit(): # XXX
            id_dict[str(arg)] = None
        else:
            raise ValueError("cannot convert arg `%s' to Job or Report" % str(arg))
    if id_dict:
        sge_acct.fill(id_dict)
    for arg in lis:
        report = None
        if type(arg) is Report:
            report = arg
        elif type(arg) is job_stats.Job:
            report = Report(arg)
        else:
            acct = id_dict[str(arg)]
            if acct:
                job = job_stats.from_acct(acct,os.getenv('TACC_STATS_HOME','/scratch/projects/tacc_stats'))
                report = Report(job)
            else:
                job_stats.error("no accounting data found for job `%s'\n", arg)
        if report:
            report.display(**kwargs)
            kwargs['print_header'] = False
Exemplo n.º 2
0
def display_list(lis, **kwargs):
    id_dict = {}
    for arg in lis:
        if type(arg) is Report or type(arg) is job_stats.Job:
            pass
        elif str(arg).isdigit():  # XXX
            id_dict[str(arg)] = None
        else:
            raise ValueError("cannot convert arg `%s' to Job or Report" %
                             str(arg))
    if id_dict:
        sge_acct.fill(id_dict)
    for arg in lis:
        report = None
        if type(arg) is Report:
            report = arg
        elif type(arg) is job_stats.Job:
            report = Report(arg)
        else:
            acct = id_dict[str(arg)]
            if acct:
                job = job_stats.from_acct(acct)
                report = Report(job)
            else:
                job_stats.error("no accounting data found for job `%s'\n", arg)
        if report:
            report.display(**kwargs)
            kwargs['print_header'] = False
Exemplo n.º 3
0
def print_mcc_stats(job):
    sock_schema = job.get_schema('amd64_sock')
    if not sock_schema or sock_schema.desc != sock_schema_desc:
        job_stats.error("job `%s' has bad or missing amd64_sock data\n", job.id)
        return
    core_schema = job.get_schema('amd64_core')
    if not core_schema or core_schema.desc != core_schema_desc:    
        job_stats.error("job `%s' has bad or missing amd64_core data\n", job.id)
        return
    print "TIME", "HOST", sock_stats_hdr, core_stats_hdr
    for host, host_entry in job.hosts.iteritems():
        sock_data = host_entry.types['amd64_sock']
        # XXX times strictly increasing?
        times = sock_data.times['0']
        d_times = numpy.diff(times, axis=0)
        sock_stats = numpy.zeros((len(d_times), len(sock_stats_cols)), numpy.float64)
        for j0, col in enumerate(sock_stats_cols):
            sock = col[0]
            j1 = sock_schema.keys[col[1]].index
            sock_stats[:, j0] = numpy.diff(sock_data.stats[sock][:, j1], axis=0) / d_times
        core_data = host_entry.types['amd64_core']
        core_stats = numpy.zeros((len(d_times), len(core_stats_cols)), numpy.float64)
        for j0, col in enumerate(core_stats_cols):
            core = col[0]
            j1 = core_schema.keys[col[1]].index
            core_stats[:, j0] = numpy.diff(core_data.stats[core][:, j1], axis=0) / d_times
        t0 = times[0]
        for i, t in enumerate(times[:-1]):
            print t - t0, host,
            for val in sock_stats[i, :]:
                print val,
            for val in core_stats[i, :]:
                print val,
            print
Exemplo n.º 4
0
def display(arg, **kwargs):
    """display(arg, file=None, print_header=False, print_record=False, prefix='+', delim=' ')
    """
    if type(arg) is Report:
        report = arg
    elif type(arg) is job_stats.Job:
        report = Report(arg)
    elif type(arg) is int or type(arg) is long or type(arg) is str:
        job = job_stats.from_id(str(arg))
        if not job:
            job_stats.error("no job for id `%s'\n", str(arg))
            return
        report = Report(arg)
    else:
        raise ValueError("cannot convert arg `%s' to Job or Report" % str(arg))
    report.display(**kwargs)
Exemplo n.º 5
0
def display(arg, **kwargs):
    """display(arg, file=None, print_header=False, print_record=False, prefix='+', delim=' ')
    """
    if type(arg) is Report:
        report = arg
    elif type(arg) is job_stats.Job:
        report = Report(arg)
    elif type(arg) is int or type(arg) is long or type(arg) is str:
        job = job_stats.from_id(str(arg))
        if not job:
            job_stats.error("no job for id `%s'\n", str(arg))
            return
        report = Report(arg)
    else:
        raise ValueError("cannot convert arg `%s' to Job or Report" % str(arg))
    report.display(**kwargs)
Exemplo n.º 6
0
def display_job_report(info):
    global opt_print_header
    id = info.get("id")
    if not id:
        job_stats.error("no id in job info\n")
        return
    job = job_stats.Job(id, info=info)
    if len(job.hosts) == 0:
        job_stats.error("job `%s' has no good hosts, skipping\n", job.id)
        return
    report = Report(job)
    if opt_print_values:
        if opt_print_header:
            report.print_header(prefix='+')
            opt_print_header = False
        report.print_values(prefix='+')
    report.display()
    print