Skip to content

Use server-side support to tail job logs#4202

Merged
hanouticelina merged 7 commits into
mainfrom
tail-job-logs-server-side
May 19, 2026
Merged

Use server-side support to tail job logs#4202
hanouticelina merged 7 commits into
mainfrom
tail-job-logs-server-side

Conversation

@coyotte508

@coyotte508 coyotte508 commented May 7, 2026

Copy link
Copy Markdown
Member

See https://github.com/huggingface-internal/moon-landing/pull/18120

Used as a test case for moon-ide. Didn't test locally


Note

Medium Risk
Extends the Jobs logs streaming path and public HfApi.fetch_job_logs signature to pass query params through SSE; mistakes could impact log retrieval/retry behavior for job log streaming.

Overview
Adds a tail parameter to HfApi.fetch_job_logs and wires it through the Jobs SSE streaming helpers so log truncation can be handled server-side, including starting a follow stream from the last N lines.

Updates hf jobs logs to allow --follow and --tail together (removing the previous CLI-side restriction and deque-based tailing), refreshes CLI docs/examples, and adjusts tests to assert the new API call shape.

Reviewed by Cursor Bugbot for commit 40af617. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment

bot-ci-comment Bot commented May 7, 2026

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@coyotte508 coyotte508 marked this pull request as ready for review May 12, 2026 13:56

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 16dd505. Configure here.

Comment thread src/huggingface_hub/hf_api.py

@hanouticelina hanouticelina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good to me! let's wait for https://github.com/huggingface-internal/moon-landing/pull/18120 to be deployed before merging.
I will ask cursor to open the same PR for Space logs as well

@coyotte508

coyotte508 commented May 13, 2026

Copy link
Copy Markdown
Member Author

@hanouticelina

Copy link
Copy Markdown
Collaborator

@coyotte508 I didn't see the commit in the last deployment on Slack and when I tested the PR, the server wasn't honoring tail yet

@coyotte508

Copy link
Copy Markdown
Member Author

https://huggingface.slack.com/archives/C023JAKTR2P/p1778506485624929 but anyway let's wait until I get E2E workings on that other PR (maybe there's a bug that'll be fixed)

@coyotte508

coyotte508 commented May 19, 2026

Copy link
Copy Markdown
Member Author

ok should all be good, and https://huggingface.co/api/jobs/coyotte508/6a033fe772518a06598ff618/logs?tail=4 (personal job) shows:

data: {"data":"===== Job started at 2026-05-12 14:57:43 =====","timestamp":"2026-05-12T14:57:43Z"}

data: {"data":"{ event: 'phase', phase: 'committing' }","timestamp":"2026-05-12T14:58:23.645Z"}

data: {"data":"Branch 'refs/convert/build' created successfully in repo 'coyotte508/fastvlm-webgpu'.","timestamp":"2026-05-12T14:58:24.755Z"}

data: {"data":"Branch 'refs/tmp/build' deleted successfully from repo 'coyotte508/fastvlm-webgpu'.","timestamp":"2026-05-12T14:58:25.157Z"}

data: {"data":"Build and upload completed successfully.","timestamp":"2026-05-12T14:58:25.162Z"}

note the data: {"data":"===== Job started at 2026-05-12 14:57:43 =====","timestamp":"2026-05-12T14:57:43Z"} line is always sent (see https://github.com/huggingface-internal/workloads/pull/4314#discussion_r3225085573) - maybe we want to fix that here or upstream (hub or jobs) idk

@hanouticelina hanouticelina left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thanks! merging unless @Wauplin you want to take a quick look at the PR

@Wauplin

Wauplin commented May 19, 2026

Copy link
Copy Markdown
Collaborator

please go ahead, looks good :)

@hanouticelina hanouticelina merged commit df05a1d into main May 19, 2026
21 checks passed
@hanouticelina hanouticelina deleted the tail-job-logs-server-side branch May 19, 2026 15:18
@huggingface-hub-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.16.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants