Skip to content

Stop re-implementing the log upload in backfill_events.py - #8596

Open
huydhn wants to merge 11 commits into
gh/huydhn/7/basefrom
gh/huydhn/7/head
Open

Stop re-implementing the log upload in backfill_events.py#8596
huydhn wants to merge 11 commits into
gh/huydhn/7/basefrom
gh/huydhn/7/head

Conversation

@huydhn

@huydhn huydhn commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Impact: tools/scripts/backfill_events.py, a manually run script
Risk: low

What

upload_log now POSTs to torchci's /api/log-uploader/backfill route instead of
downloading the log, gzipping it, putting it in S3, and pinging the classifier
itself. Needs LOG_UPLOADER_BOT_KEY, and honours HUD_URL for testing against a
preview deployment.

Also drops the S3 raw-event archive write from process_event, leaving only the
DynamoDB write.

[ghstack-poisoned]
@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
torchci Ignored Ignored Aug 21, 2026 10:51pm

Request Review

huydhn added 2 commits August 20, 2026 13:01
[ghstack-poisoned]
[ghstack-poisoned]
huydhn added 3 commits August 20, 2026 15:17
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@huydhn
huydhn marked this pull request as ready for review August 20, 2026 23:55
@huydhn
huydhn requested a review from izaitsevfb August 20, 2026 23:55
huydhn added 4 commits August 20, 2026 23:41
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]

@izaitsevfb izaitsevfb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

def upload_log(owner: str, repo: str, job_id: int, conclusion: str) -> None:
if not LOG_UPLOADER_BOT_KEY:
warn("LOG_UPLOADER_BOT_KEY is not set, skipping the log upload...")
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make failure explicit? or validate the key presence early


🟡 Without `LOG_UPLOADER_BOT_KEY` the script skips every log upload without failing. (ai-generated section)

upload_log warns and returns for every job when the key is empty, and it is called once per job from process_workflow_run. Under Python's default warning filter that identical warning is emitted only once per process, so a run over thousands of jobs prints it a single time, early, among the repeated ..Processing N jobs... output, then keeps writing DynamoDB rows; an otherwise successful run exits 0 with no log uploaded. A key that is set but wrong is louder — the route answers 403 and the warning carries the job id, so it repeats per job — but that run also ends successfully with nothing uploaded. Validating the key once in backfill() before the loop starts, and stopping on the first 401 or 403, puts both decisions where the operator can still act on them.

Reviewed by codex gpt-5.6-sol at xhigh effort, against 5a2abf5.

+ f"{error}, skipping..."
f"Failed to request a log upload for job {job_id} from repo "
f"{owner}/{repo}: {error}, skipping..."
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment consistency nit.


⚪ The comment above the `try` block describes a failure this block cannot see. (ai-generated section)

A 200 from /api/log-uploader/backfill means the upload was queued for an asynchronous Lambda invocation, not that GitHub still had the log — so an expired log cannot produce a warning at this call site, and the download error appears only in the uploader lambda's own logs. Please drop the expiration comment or replace it with what this block does handle, which is the POST and its network failures.

Reviewed by codex gpt-5.6-sol at xhigh effort, against 5a2abf5.

[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants