def process(db, cust_roots): """Process all MIP output.""" family_dirs = list(automate.case_roots(*cust_roots)) analyses = (load_analysis(family_dir, insanity=True) for family_dir in family_dirs) total = len(family_dirs) with click.progressbar(analyses, label='mip | analyses', length=total) as bar: for analysis in bar: process_one(db, analysis) try: db.commit() except (OperationalError, IntegrityError): logger.exception('error in saving mip analysis') db.session.rollback()
def traverse(context, step, cust_roots): """Upload all cases found by traversing the root directories.""" if len(cust_roots) == 0: cust_roots = expand_paths(*context.obj.get("customer_roots", [])) for case_path in automate.case_roots(*cust_roots): try: mip_case = info.analysis(case_path) if not mip_case.is_complete: logger.debug("skipping non-complete case: %s", case_path) elif "Path" not in mip_case._family["VCFFile"]["Clinical"]: logger.warn("analysis run in non-standard mode") elif step: logger.debug("processing %s: %s", case_path, step) context.invoke(do, case_path=case_path, step=step) else: logger.debug("processing case: %s", case_path) context.invoke(do, case_path=case_path, run_all=True) except Exception as error: logger.exception("unexpected error loading: %s", case_path)
def test_case_roots(): cases = automate.case_roots('tests/fixtures/analysis/customers/cust000', 'tests/fixtures/analysis/customers/cust001') assert len(list(cases)) == 3