Esempio n. 1
0
def summarize(seed_path):
    '''Return summary of data found at seed path as dictionary for
    use by summary.html.j2 and as one element in the index'''

    seed = io.load_path(seed_path)
    ret = raw.common_params('feasic', **seed)

    ret['fe_ids'] = [raw.fix_asic_id(seed['asic%did' % n]) for n in range(4)]
    bid = ret['fe_testboard_id'] = raw.fix_board_id(seed['boardid'])
    ret['serial'] = "board%s" % bid

    ts = ret['timestamp']
    ident = bid + '-' + ts
    ret['ident'] = ident

    ret['label'] = smt_labels.get(ts, None)

    parent = os.path.dirname(os.path.dirname(seed_path))
    ret['datadir'] = parent

    results = dict()

    png_sources = list()
    pdf_sources = list()

    ret['install'] = list()
    for param_fname in glob(os.path.join(parent, "*/params.json")):
        # shunt a few job specific input parameters
        thisp = io.load(open(param_fname, 'r'))
        datasubdir = thisp.get('datasubdir', None)
        if not datasubdir:
            continue  # power, check_setup

        resfile = glob(param_fname.replace("params.json", "*-results.json"))
        resdat = dict()
        if resfile:
            one = io.load(open(resfile[0], 'r'))
            resdat = summarize_feasic_result(one)

        sd = os.path.dirname(param_fname)

        for ext in ['png', 'pdf']:
            key = ext + 's'
            glb = '*.' + ext
            srcs = glob(os.path.join(sd, glb))
            ret['install'] += srcs
            resdat[key] = [os.path.basename(p) for p in srcs]

        results[datasubdir] = resdat

    ret['results'] = results
    ret['associations'] = dict(
        feid=ret['fe_ids'])  # could add adc ids and fe board
    return ret
Esempio n. 2
0
def indexer(summary_fps):
    'Return index data structure from a sequence of file like things'
    ret = dict()
    for fp in summary_fps:
        summary = io.load(fp)
        ret[summary['ident']] = summary
    return ret
Esempio n. 3
0
def indexer(summary_fps):
    'Index FE ASIC tests'
    ret = dict()
    for fp in summary_fps:
        summary = io.load(fp)
        ret[summary['ident']] = summary
    return ret
Esempio n. 4
0
def summarize(seed_path):
    '''Return summary of data found at seed path as dictionary for
    use by summary.html.j2 and as one element in the index'''

    seed = io.load_path(seed_path)
    ret = raw.common_params('femb', **seed)

    bid = list()
    ret['fe_ids'] = raw.fix_list(seed['fe_asics'][0], raw.fix_asic_id)
    ret['adc_ids'] = raw.fix_list(seed['adc_asics'][0], raw.fix_asic_id)
    for key in 'box_ids fm_ids am_ids'.split():
        ident = seed[key][0]  #  just first entry
        if ident:
            ret[key] = ident
        else:
            ret[key] = "no_" + key
            continue
        bid.append(ident)
    if not bid:
        ret['serial'] = 'bogus'
    else:
        ret['serial'] = '-'.join(bid)

    ret['ident'] = ret['serial'] + '-' + ret['timestamp']

    #ret['label'] = smt_labels.get(ts, None)

    results = dict()
    parent = os.path.dirname(os.path.dirname(seed_path))
    ret['datadir'] = parent
    ret['install'] = list()
    for param_fname in glob(os.path.join(parent, "*/params.json")):
        datasubdir = os.path.basename(os.path.dirname(param_fname))

        resdat = dict()
        resfile = glob(param_fname.replace("params.json", "*-results.json"))
        if resfile:
            one = io.load(open(resfile[0], 'r'))
            resdat = summarize_femb_result(one)

        # record graphics files for installation as well as
        # destination use with care to make destination files uniquely
        # named
        sd = os.path.dirname(param_fname)
        for ext in ['png', 'pdf']:
            key = ext + 's'
            glb = '*.' + ext
            srcs = glob(os.path.join(sd, glb))
            dsts = ['_'.join(p.split('/')[-2:]) for p in srcs]
            ret['install'] += [(s, d) for s, d in zip(srcs, dsts)]
            resdat[key] = dsts

        results[datasubdir] = resdat

    if results:  # for plots
        ret['completed'] = 1
        ret['aborted'] = 0
    else:
        ret['completed'] = 0
        ret['aborted'] = 1

    ret['associations'] = dict(feid=ret['fe_ids'], adcid=ret['adc_ids'])
    ret['results'] = results
    return ret