Beispiel #1
0
def run_orabort(context, case_name, date_str=None):
    """Get a run or abort the Click context."""
    run_date = utils.build_date(date_str) if date_str else None
    run_obj = api.runs(case_name, run_date=run_date).first()
    if run_obj is None:
        log.error("no analysis run found for case: %s", case_name)
        context.abort()
    else:
        return run_obj
Beispiel #2
0
def run_fromtar(tar_path):
    """Get the run record for a tar archive."""
    with tarfile.open(tar_path, 'r:*') as in_handle:
        filename = 'meta.yaml'
        meta_file = in_handle.extractfile(filename)
        meta_data = yaml.load(meta_file)

    run_date = meta_data['analyzed_at'].date()
    query = api.runs(meta_data['name'], run_date=run_date)
    run_obj = query.first()
    return run_obj