From ba38aaf6920b246f6644cfb49730a5e2ee5f9db0 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Tue, 7 Jul 2020 17:17:31 -0400 Subject: --print-status=html creates html report --- bh20seqanalyzer/main.py | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/bh20seqanalyzer/main.py b/bh20seqanalyzer/main.py index 2fefa86..1746587 100644 --- a/bh20seqanalyzer/main.py +++ b/bh20seqanalyzer/main.py @@ -235,9 +235,10 @@ def upload_schema(api, workflow_def_project): return "keep:%s/schema.yml" % pdh -def print_status(api, uploader_project): +def print_status(api, uploader_project, fmt): pending = arvados.util.list_all(api.collections().list, filters=[["owner_uuid", "=", uploader_project]]) out = [] + status = {} for p in pending: prop = p["properties"] out.append(prop) @@ -245,7 +246,38 @@ def print_status(api, uploader_project): prop["status"] = "pending" prop["created_at"] = p["created_at"] prop["uuid"] = p["uuid"] - print(json.dumps(out, indent=2)) + status[prop["status"]] = status.get(prop["status"], 0) + 1 + if fmt == "html": + print( +""" + + +""") + print("

Total collections in upload project %s

" % len(out)) + print("

Status %s

" % status) + print( +""" + + + + + +""") + for r in out: + print("") + print("" % (r["uuid"], r["uuid"])) + print("" % r["sequence_label"]) + print("" % r["status"]) + print("" % "\n".join(r.get("errors", []))) + print("") + print( +""" +
CollectionSequence labelStatusErrors
%s%s%s
%s
+ + +""") + else: + print(json.dumps(out, indent=2)) def main(): parser = argparse.ArgumentParser(description='Analyze collections uploaded to a project') @@ -264,7 +296,7 @@ def main(): parser.add_argument('--kickoff', action="store_true") parser.add_argument('--no-start-analysis', action="store_true") parser.add_argument('--once', action="store_true") - parser.add_argument('--print-status', action="store_true") + parser.add_argument('--print-status', type=str, default=None) args = parser.parse_args() api = arvados.api() @@ -284,7 +316,7 @@ def main(): return if args.print_status: - print_status(api, args.uploader_project) + print_status(api, args.uploader_project, args.print_status) exit(0) logging.info("Starting up, monitoring %s for uploads" % (args.uploader_project)) -- cgit v1.2.3