-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Aggeregate test summary files in CircleCI workflow runs #34989
Merged
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
729f61f
fix
ydshieh 573455d
fix
ydshieh d788ffa
fix
ydshieh 337956e
fix
ydshieh 8367992
fix
ydshieh 97efbd0
fix
ydshieh 17ac09a
fix
ydshieh e95bc11
fix
ydshieh c24625f
fix
ydshieh b8f2f76
fix
ydshieh 01037c6
fix
ydshieh f29dc9b
fix
ydshieh 6086f9d
fix
ydshieh 6bf6dca
fix
ydshieh 95dac99
fix
ydshieh 6f41cd8
fix
ydshieh 4329c26
fix
ydshieh 31ff1a1
fix
ydshieh 1a1a10d
fix
ydshieh 16b7459
fix
ydshieh 9833fac
fix
ydshieh 48234c7
fix
ydshieh f0d2bba
fix
ydshieh ad3b42c
fix
ydshieh a012473
fix
ydshieh 00d5976
fix
ydshieh aa65c71
fix
ydshieh 49e9e3f
fix
ydshieh 1841f56
fix
ydshieh 67935a6
fix
ydshieh 0ea4bb1
fix
ydshieh 3fc2af7
fix
ydshieh 9d143f5
fix
ydshieh 3e2ff0c
fix
ydshieh 55aa01c
fix
ydshieh b3d8212
try 1
ydshieh 75da5b8
try 1
ydshieh 428b937
try 1
ydshieh a355972
try 1
ydshieh 6f94ad8
try 1
ydshieh 339e0f3
try 1
ydshieh 931bd56
try 1
ydshieh ea08752
try 1
ydshieh a89920b
try 1
ydshieh 1bf1088
try 1
ydshieh dab6281
try 1
ydshieh 5a9978a
try 1
ydshieh 84cb015
try 1
ydshieh ef53bf4
try 1
ydshieh fbc3390
try 1
ydshieh 2ac2158
try 1
ydshieh f0b3c5d
try 1
ydshieh cc6600a
try 1
ydshieh 12852e4
try 1
ydshieh eb0125d
try 1
ydshieh 3be7105
try 1
ydshieh c9ef06e
try 1
ydshieh 64bf5e0
try 1
ydshieh c93e34c
try 1
ydshieh d471968
try 1
ydshieh eda984c
try 1
ydshieh 90f3a0a
try 1
ydshieh 553e163
try 1
ydshieh af2ddf2
try 1
ydshieh a1f7c63
try 1
ydshieh f285200
try 1
ydshieh 9d45dbc
try 1
ydshieh 6ea3002
try 1
ydshieh 977d27e
try 1
ydshieh 4a1d93a
try 1
ydshieh 74be7c0
try 1
ydshieh f7ab430
try 1
ydshieh 9200176
try 1
ydshieh 358f86c
try 1
ydshieh dd7fee4
try 1
ydshieh 99c89d6
try 1
ydshieh 3818ab0
fix
ydshieh ce760fa
fix
ydshieh a4586f0
fix
ydshieh fa07279
update
ydshieh 3ce5700
Merge branch 'main' into final_job
ydshieh d14de3d
fix
ydshieh aa16edc
Merge branch 'final_job' of https://github.com/huggingface/transforme…
ydshieh b9d4bfb
fix
ydshieh c174645
Merge branch 'main' into final_job
ydshieh ef7f6a8
Merge branch 'main' into final_job
ydshieh 0e6d198
Merge branch 'main' into final_job
ydshieh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Copyright 2024 The HuggingFace Team. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import argparse | ||
import json | ||
import os | ||
|
||
import requests | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--workflow_id", type=str, required=True) | ||
args = parser.parse_args() | ||
workflow_id = args.workflow_id | ||
|
||
r = requests.get( | ||
f"https://circleci.com/api/v2/workflow/{workflow_id}/job", | ||
headers={"Circle-Token": os.environ.get("CIRCLE_TOKEN", "")}, | ||
) | ||
jobs = r.json()["items"] | ||
|
||
os.makedirs("outputs", exist_ok=True) | ||
|
||
workflow_summary = {} | ||
# for each job, download artifacts | ||
for job in jobs: | ||
project_slug = job["project_slug"] | ||
if job["name"].startswith(("tests_", "examples_", "pipelines_")): | ||
url = f'https://circleci.com/api/v2/project/{project_slug}/{job["job_number"]}/artifacts' | ||
r = requests.get(url, headers={"Circle-Token": os.environ.get("CIRCLE_TOKEN", "")}) | ||
job_artifacts = r.json()["items"] | ||
|
||
os.makedirs(job["name"], exist_ok=True) | ||
os.makedirs(f'outputs/{job["name"]}', exist_ok=True) | ||
|
||
job_test_summaries = {} | ||
for artifact in job_artifacts: | ||
if artifact["path"].startswith("reports/") and artifact["path"].endswith("/summary_short.txt"): | ||
node_index = artifact["node_index"] | ||
url = artifact["url"] | ||
r = requests.get(url, headers={"Circle-Token": os.environ.get("CIRCLE_TOKEN", "")}) | ||
test_summary = r.text | ||
job_test_summaries[node_index] = test_summary | ||
|
||
summary = {} | ||
for node_index, node_test_summary in job_test_summaries.items(): | ||
for line in node_test_summary.splitlines(): | ||
if line.startswith("PASSED "): | ||
test = line[len("PASSED ") :] | ||
summary[test] = "passed" | ||
elif line.startswith("FAILED "): | ||
test = line[len("FAILED ") :].split()[0] | ||
summary[test] = "failed" | ||
# failed before passed | ||
summary = dict(sorted(summary.items(), key=lambda x: (x[1], x[0]))) | ||
workflow_summary[job["name"]] = summary | ||
|
||
# collected version | ||
with open(f'outputs/{job["name"]}/test_summary.json', "w") as fp: | ||
json.dump(summary, fp, indent=4) | ||
|
||
new_workflow_summary = {} | ||
for job_name, job_summary in workflow_summary.items(): | ||
for test, status in job_summary.items(): | ||
if test not in new_workflow_summary: | ||
new_workflow_summary[test] = {} | ||
new_workflow_summary[test][job_name] = status | ||
|
||
for test, result in new_workflow_summary.items(): | ||
new_workflow_summary[test] = dict(sorted(result.items())) | ||
new_workflow_summary = dict(sorted(new_workflow_summary.items())) | ||
|
||
with open("outputs/test_summary.json", "w") as fp: | ||
json.dump(new_workflow_summary, fp, indent=4) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using the junit.xlm will be more "foolproof" than regex parsing no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no regex in this script.
Regarding
junit.xlm
, yes probably morefoolproof
, but more post-process to be done I think:xml
's structure is more complex thensummary_short.txt
.tests/generation/test_utils.py::GenerationIntegrationTests::test_generated_length_assisted_generation
that we could copy-paste and run directly.summary_short.txt
is working well in a very simple way. If we findxlm
is necessary in the future, happy to make the change however.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sounds good!