Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test report after queuing job added #7012

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions continuous_integration/scripts/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,31 @@ def get_jobs(run, session):
cache[url] = jobs

df_jobs = pandas.DataFrame.from_records(jobs)
# Interpolate the `$TEST_ID` variable from the job name.
# Somehow the job ID is not part of the workflow schema and we have no other way to later join
# this to the JXML results.

name_components = (
df_jobs.name.str.extract(r"test \((.+)\)", expand=False)
.dropna()
.str.split(", ", expand=True)
.set_axis(["OS", "python_version", "queuing", "partition"], axis="columns")
.assign(
# We later need to join on this. Somehow the job ID is not part of the workflow schema and we have no other way to join
suite_name=lambda df: df["OS"]
+ "-"
+ df["python_version"]
+ "-"
+ df["queuing"]
+ "-"
+ df["partition"].str.replace(" ", "")
)
)
return pandas.concat([df_jobs, name_components], axis="columns")
if len(name_components.columns) == 4:
name_components.columns = ["OS", "python_version", "queuing", "partition"]
elif len(name_components.columns) == 3:
# Migration: handle older jobs without the `queuing` configuration.
# This branch can be removed after 2022-12-07.
name_components.columns = ["OS", "python_version", "partition"]
else:
raise ValueError(f"Job names must have 3 or 4 components:\n{name_components!r}")

# See `Set $TEST_ID` step in `tests.yaml`
name_components["partition"] = name_components.partition.str.replace(" ", "")

df_jobs["suite_name"] = name_components.iloc[:, 0].str.cat(
name_components.iloc[:, 1:], sep="-"
)
return df_jobs


def get_workflow_run_listing(
Expand Down Expand Up @@ -206,7 +214,12 @@ def suite_from_name(name: str) -> str:
can have matrix partitions, pytest marks, etc. Basically,
just lop off the front of the name to get the suite.
"""
return "-".join(name.split("-")[:4])
parts = name.split("-")
if len(parts) == 4: # [OS, 'latest', py_version, $PARTITION_LABEL]
# Migration: handle older jobs without the `queuing` configuration.
# This branch can be removed after 2022-12-07.
parts.insert(3, "no_queue")
return "-".join(parts[:4])


def download_and_parse_artifact(
Expand Down Expand Up @@ -354,7 +367,7 @@ def download_and_parse_artifacts(
html_url = jobs_df[jobs_df["suite_name"] == a["name"]].html_url.unique()
assert (
len(html_url) == 1
), f"Artifact suit name {a['name']} did not match any jobs dataframe {jobs_df['suite_name'].unique()}"
), f"Artifact suite name {a['name']} did not match any jobs dataframe:\n{jobs_df['suite_name'].unique()}"
html_url = html_url[0]
assert html_url is not None
df2 = df.assign(
Expand Down