Skip to content

feat: show tqdm for _ensure_provider_ready - #788

Merged
xieofxie merged 17 commits into
mainfrom
hualxie/ep_downloading
Jun 4, 2026
Merged

xieofxie merged 17 commits into
mainfrom
hualxie/ep_downloading

Conversation

@xieofxie

@xieofxie xieofxie commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

Closes #725

winml sys <

image

Failed

image

@xieofxie
xieofxie requested a review from a team as a code owner May 29, 2026 04:09
DingmaomaoBJTU

This comment was marked as duplicate.

DingmaomaoBJTU

This comment was marked as duplicate.

DingmaomaoBJTU

This comment was marked as duplicate.

DingmaomaoBJTU

This comment was marked as duplicate.

DingmaomaoBJTU

This comment was marked as duplicate.

DingmaomaoBJTU

This comment was marked as duplicate.

DingmaomaoBJTU

This comment was marked as duplicate.

DingmaomaoBJTU

This comment was marked as duplicate.

DingmaomaoBJTU

This comment was marked as duplicate.

DingmaomaoBJTU

This comment was marked as duplicate.

Comment thread src/winml/modelkit/session/ep_registry.py Outdated
DingmaomaoBJTU

This comment was marked as duplicate.

Comment thread src/winml/modelkit/session/ep_registry.py Outdated
Comment thread src/winml/modelkit/session/ep_registry.py
Comment thread src/winml/modelkit/session/ep_registry.py
DingmaomaoBJTU

This comment was marked as duplicate.

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.

Nice implementation. The async flow with threading.Event is clean, the timeout is configurable via env var, and tests are thorough. Two minor observations below.

Comment thread src/winml/modelkit/session/ep_registry.py
Comment thread src/winml/modelkit/session/ep_registry.py
Comment thread tests/unit/session/test_ep_registry.py Fixed
Comment thread src/winml/modelkit/session/ep_registry.py Outdated
Comment thread src/winml/modelkit/session/ep_registry.py
Comment thread src/winml/modelkit/session/ep_registry.py
Comment thread src/winml/modelkit/session/ep_registry.py
Comment thread src/winml/modelkit/session/ep_registry.py
Comment thread src/winml/modelkit/session/ep_registry.py
@xieofxie
xieofxie merged commit b3dfe2f into main Jun 4, 2026
9 checks passed
@xieofxie
xieofxie deleted the hualxie/ep_downloading branch June 4, 2026 07:53
Qiong Wu (qiowu) (DingmaomaoBJTU) pushed a commit that referenced this pull request Jun 5, 2026
Closes #725

winml sys <

<img width="2082" height="252" alt="image"
src="https://github.com/user-attachments/assets/6520c1e3-3e17-43cb-907c-4696b0fd6256"
/>


Failed

<img width="2078" height="128" alt="image"
src="https://github.com/user-attachments/assets/56de05db-68e2-478a-8326-d1b3bafd605d"
/>

---------

Co-authored-by: hualxie <hualxie@microsoft.com>
xieofxie added a commit that referenced this pull request Jul 29, 2026
…1239)

## Summary

Restores the EP-download progress bar that previously existed in
`ep_registry.py` ([PR
#788](#788)) but was dropped
during the #1019 EP-discovery refactor, when the
`provider.ensure_ready()` call moved into
`WinMLCatalogSource._resolve_provider` in `ep_path.py` and lost its
progress UX.

## What changed

**`src/winml/modelkit/ep_path.py`** — cherry-picked the progress
machinery and wired it into the resolve path:
- `_ep_download_timeout_default()` + `EP_DOWNLOAD_TIMEOUT_SECONDS` —
honors `WINMLCLI_EP_DOWNLOAD_TIMEOUT` (default 5 min).
- `_NoopBar` + `_make_progress_bar()` — tqdm bar with a silent fallback
when tqdm or `sys.stderr` is unavailable (production installs / spawn
workers).
- `_parse_ep_metadata_from_path()` — recovers `(version,
package_family_name)` from the MSIX `WindowsApps` install path when the
native handle reports them empty.
- `_ensure_provider_ready()` — prints the `[WinML] Installing Execution
Provider` notice, drives a live tqdm bar from `ensure_ready_async`'s
`on_progress` callback, waits on `on_complete` with a timeout+cancel,
and prints success / ❌-failure guidance plus version/PFN.
- `WinMLCatalogSource._resolve_provider` now calls
`_ensure_provider_ready(provider)` instead of the silent
`provider.ensure_ready()`.

### Note on the sync fast-path
The original helper had a `from windowsml import EpReadyState` sync
fast-path for already-`Ready` providers. The current
`WinMLCatalogSource` deliberately avoids that coupling (string-based
readiness checks) and only invokes this helper on the cold, not-Ready
path, so the fast-path was dead code — it's dropped, keeping the helper
focused purely on the download+progress flow.

**Tests**
- Added `tests/unit/ep_path/test_ensure_provider_ready.py` — ported the
PR #788 coverage (progress bar, stale-callback drop, timeout/cancel,
`get_status` error, metadata printing/fallback, failure messages,
no-tqdm fallback, timeout-env parsing).
- Updated `tests/unit/ep_path/test_winml_catalog_source.py` fakes to the
async download contract.

## Verification
- `ruff check` clean
- `mypy -p winml.modelkit` — no issues (426 files)
- `pytest tests/unit/ep_path/` — 178 passed, 2 skipped
(EP-install-gated)

---------

Co-authored-by: Hualiang Xie <hualxie@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

show progress bar for EP downloading

3 participants