Commit 3c1b6994 authored by Jan Kiene's avatar Jan Kiene
Browse files

add heading and info about jobs that are being compared

parent 3d2cb3f1
Loading
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -19,6 +19,16 @@ SUBPAGE_TMPL_CSS = """

SUBPAGE_TMPL_HTML = """

<h1>Report for job {job_name}</h1

Comparing:
<ul>
    <li>Current run - id: {id_current}</li>
    <li>Previous run - id: {id_previous}</li>
</ul>

<br>

<table class="tbase"><thead>
  <tr>
    <th class="tunder" rowspan="2">Testcase</th>
@@ -43,7 +53,7 @@ COLUMNS = ["testcase", "MLD", "MAXIMUM ABS DIFF"]


def create_subpage(
    html_out, csv_current: str, csv_previous: str, id_current: int, id_previous: int
        html_out, csv_current: str, csv_previous: str, id_current: int, id_previous: int, job_name: str
):
    merged_reports = merge_and_cleanup_mld_reports(
        csv_current, csv_previous, id_current, id_previous
@@ -52,7 +62,7 @@ def create_subpage(
        tr_from_row(row, id_current, id_previous) for row in merged_reports
    )
    new_subpage = SUBPAGE_TMPL_CSS + SUBPAGE_TMPL_HTML.format(
        id_current=id_current, id_previous=id_previous, table_body=table_body
        id_current=id_current, id_previous=id_previous, table_body=table_body, job_name=job_name
    )
    with open(html_out, "w") as f:
        f.write(new_subpage)
@@ -64,8 +74,8 @@ def tr_from_row(row, id_current, id_previous):
        try:
            tr.append(TD_TMPL.format(row[c]))
        except KeyError:
            tr.append(TD_TMPL.format(row[f"{c}-{id_current}"]))
            tr.append(TD_TMPL.format(row[f"{c}-{id_previous}"]))
            tr.append(TD_TMPL.format(row[f"{c}-{id_current}"]))

    return TR_TMPL.format("\n".join(tr))

@@ -122,14 +132,6 @@ def merge_tables(tbl1, tbl2, suffix1, suffix2, merge_key, other_keys):
    return merged


create_subpage(
    "/tmp/html_out.html",
    "/Users/knj/Downloads/mld(1).csv",
    "/Users/knj/Downloads/mld(2).csv",
    "CURR",
    "PREV",
)

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("html_out")
@@ -137,6 +139,7 @@ if __name__ == "__main__":
    parser.add_argument("csv_previous")
    parser.add_argument("id_current", type=int)
    parser.add_argument("id_previous", type=int)
    parser.add_argument("job_name")
    args = parser.parse_args()

    create_subpage(
@@ -145,4 +148,5 @@ if __name__ == "__main__":
        args.csv_previous,
        args.id_current,
        args.id_previous,
        args.job_name
    )