-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Studio: fix download card alignment and surface the stop button #7848
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3e42b34
Studio: line the download progress bar up with the row above it
shimmyshimmer c9d479b
Studio: show the download stop button instead of hiding it behind hover
shimmyshimmer c5dfee8
Studio: read the stop mode from the running job, not an old partial
shimmyshimmer 406b2d0
Preserve download transport across adoption
08cec39
Studio: take the transport from the job an accepted start adopted
shimmyshimmer 36962e0
Studio: report the transport a download actually runs on, everywhere
shimmyshimmer 622afba
Studio: decide the stop control from the cancel marker, not just the …
shimmyshimmer dc863be
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2fa9f75
Studio: carry the cancel marker through every path that learns a tran…
shimmyshimmer 55e8841
Studio: persist the cancel marker beside the transport it qualifies
shimmyshimmer 2579c4e
Studio: keep a persisted cancel marker when adoption reports none
shimmyshimmer 9726ce9
Studio: let a reported "no cancel marker" clear a stale one
shimmyshimmer 94dda0d
Merge remote-tracking branch 'origin/main' into studio-download-card-…
shimmyshimmer 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
127 changes: 127 additions & 0 deletions
127
studio/backend/tests/test_download_adoption_transport.py
This file contains hidden or 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,127 @@ | ||
| # SPDX-License-Identifier: AGPL-3.0-only | ||
| # Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0 | ||
|
|
||
| """A start that adopts a running job reports the transport that job is on.""" | ||
|
|
||
| from hub.utils.download_registry import DownloadRegistry | ||
|
|
||
|
|
||
| def _claim(registry, key, transport): | ||
| accepted, state = registry.claim( | ||
| key, | ||
| transport, | ||
| repo_type = "model", | ||
| repo_id = key.split("::", 1)[0], | ||
| ) | ||
| return accepted, state | ||
|
|
||
|
|
||
| def test_a_running_job_reports_the_transport_it_started_on(): | ||
| registry = DownloadRegistry() | ||
| assert _claim(registry, "unsloth/Qwen3-4B-GGUF", "xet") == (True, "running") | ||
|
|
||
| # The second client asked for HTTP; the claim is refused and it adopts. | ||
| accepted, state = _claim(registry, "unsloth/Qwen3-4B-GGUF", "http") | ||
| assert accepted is False and state == "running" | ||
| assert registry.adoptable("unsloth/Qwen3-4B-GGUF") is True | ||
| # What it must be told, rather than the http it asked for: pausing a Xet | ||
| # run promises a resume that does not exist. | ||
| assert registry.job_transport("unsloth/Qwen3-4B-GGUF") == "xet" | ||
|
|
||
|
|
||
| def test_an_unknown_job_has_no_transport_to_report(): | ||
| registry = DownloadRegistry() | ||
| assert registry.job_transport("unsloth/never-started") is None | ||
|
|
||
|
|
||
| def test_a_job_claimed_without_metadata_reports_nothing(): | ||
| registry = DownloadRegistry() | ||
| assert registry.claim("unsloth/bare", "http")[0] is True | ||
| assert registry.job_transport("unsloth/bare") is None | ||
|
|
||
|
|
||
| def test_a_fresh_start_reports_the_transport_the_backend_resolved(monkeypatch): | ||
| """An explicit Xet request is downgraded where hf_xet is unavailable, and a | ||
| client that assumed its request stood shows Cancel for a resumable HTTP | ||
| transfer.""" | ||
| from hub.services import download_lifecycle | ||
|
|
||
| monkeypatch.setattr( | ||
| download_lifecycle.download_registry, | ||
| "download_transport_unavailable_reason", | ||
| lambda transport: "hf_xet is not installed" if transport == "xet" else None, | ||
| ) | ||
| use_xet, _reason = download_lifecycle.resolve_requested_use_xet("xet", True) | ||
| assert use_xet is False, "the downgrade this reports is what the client must be told" | ||
| assert download_lifecycle.resolve_transport(use_xet) == "http" | ||
|
|
||
|
|
||
| def test_an_available_xet_request_is_left_alone(monkeypatch): | ||
| from hub.services import download_lifecycle | ||
|
|
||
| monkeypatch.setattr( | ||
| download_lifecycle.download_registry, | ||
| "download_transport_unavailable_reason", | ||
| lambda transport: None, | ||
| ) | ||
| use_xet, _reason = download_lifecycle.resolve_requested_use_xet("xet", True) | ||
| assert download_lifecycle.resolve_transport(use_xet) == "xet" | ||
|
|
||
|
|
||
| def test_a_fallback_run_publishes_the_marker_that_decides_its_stop_control(): | ||
| """The Xet-to-HTTP retry reclaims as HTTP but keeps the Xet cancel marker, | ||
| so stopping it is a restart even though the worker is on HTTP.""" | ||
| from hub.services.download_lifecycle import active_download_refs | ||
|
|
||
| registry = DownloadRegistry() | ||
| key = "unsloth/Qwen3-4B-GGUF" | ||
| assert ( | ||
| registry.claim( | ||
| key, | ||
| "http", | ||
| repo_type = "model", | ||
| repo_id = key, | ||
| cancel_marker_transport = "xet", | ||
| )[0] | ||
| is True | ||
| ) | ||
|
|
||
| ref = active_download_refs(registry, key, with_variant = True)[0] | ||
| assert ref.transport == "http", "the worker really is on HTTP" | ||
| assert ref.cancel_transport == "xet", "but cancelling writes the Xet marker" | ||
|
|
||
|
|
||
| def test_an_ordinary_run_publishes_no_cancel_marker(): | ||
| from hub.services.download_lifecycle import active_download_refs | ||
|
|
||
| registry = DownloadRegistry() | ||
| key = "unsloth/Qwen3-4B-GGUF" | ||
| registry.claim(key, "http", repo_type = "model", repo_id = key) | ||
| ref = active_download_refs(registry, key, with_variant = True)[0] | ||
| assert ref.cancel_transport is None | ||
|
|
||
|
|
||
| def test_an_adopted_fallback_run_reports_its_marker_to_the_new_client(): | ||
| """The start response is the only source for that adoption path, so it has | ||
| to carry the marker as well as the live transport.""" | ||
| registry = DownloadRegistry() | ||
| key = "unsloth/Qwen3-4B-GGUF" | ||
| registry.claim( | ||
| key, | ||
| "http", | ||
| repo_type = "model", | ||
| repo_id = key, | ||
| cancel_marker_transport = "xet", | ||
| ) | ||
| # What the rejected second claim then reports. | ||
| assert registry.adoptable(key) is True | ||
| assert registry.job_transport(key) == "http" | ||
| assert registry.job_cancel_transport(key) == "xet" | ||
|
|
||
|
|
||
| def test_an_ordinary_adopted_run_reports_no_marker(): | ||
| registry = DownloadRegistry() | ||
| key = "unsloth/Qwen3-4B-GGUF" | ||
| registry.claim(key, "xet", repo_type = "model", repo_id = key) | ||
| assert registry.job_cancel_transport(key) is None | ||
| assert registry.job_cancel_transport("unsloth/never-started") is None |
This file contains hidden or 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
21 changes: 10 additions & 11 deletions
21
studio/frontend/src/features/hub/catalog/download-cancel-indicator.tsx
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
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.
When another client starts the same key while the live job has already fallen back from Xet to HTTP, this start response is the only data source for the non-
opts.adoptadoption path. Fresh evidence beyond the earlier retry-semantics concern is that active downloads now exposecancel_transport, but the start response only exposestransport, so the frontend recordshttpwith nocancelTransportand offers Pause even though cancelling still writes the Xet marker and leaves a Redownload-only partial; include the marker in both model and dataset accepted-start responses.Useful? React with 👍 / 👎.