modelscope-hub 0.7.0__tar.gz → 0.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {modelscope_hub-0.7.0/src/modelscope_hub.egg-info → modelscope_hub-0.7.2}/PKG-INFO +57 -6
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/README.md +56 -5
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/pyproject.toml +1 -1
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_download.py +85 -22
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_download_state.py +35 -4
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_resilient_download.py +6 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/api.py +11 -2
- modelscope_hub-0.7.2/src/modelscope_hub/cli/kernels.py +131 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/main.py +2 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/compat/hub_api.py +5 -4
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/constants.py +10 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/kernels/__init__.py +2 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/kernels/_hub.py +38 -7
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/kernels/_load.py +66 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/version.py +1 -1
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2/src/modelscope_hub.egg-info}/PKG-INFO +57 -6
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub.egg-info/SOURCES.txt +4 -0
- modelscope_hub-0.7.2/tests/test_cli_kernels.py +114 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_download_integrity.py +80 -3
- modelscope_hub-0.7.2/tests/test_download_snapshot_identifier.py +454 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_kernels.py +146 -0
- modelscope_hub-0.7.2/tests/test_modelscope_download_compatibility.py +231 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/LICENSE +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/setup.cfg +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/__init__.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_cache_manager.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_download_control.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_git.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_legacy_api.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_openapi.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_repository.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/_upload.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/agent/__init__.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/agent/_api.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/agent/_plugin.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/agent_idp.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/__init__.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/agent.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/agent_idp.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/base.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/cache.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/compat.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/deploy.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/download.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/login.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/mcp.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/repo.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/secret.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/studio.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/cli/upload.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/compat/__init__.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/compat/constants.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/compat/file_download.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/compat/snapshot_download.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/config.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/errors.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/kernels/_patch.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/py.typed +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/types.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/utils/__init__.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/utils/file_utils.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/utils/format.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/utils/logger.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/utils/media.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/utils/patterns.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub/utils/time_utils.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub.egg-info/dependency_links.txt +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub.egg-info/entry_points.txt +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub.egg-info/requires.txt +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/src/modelscope_hub.egg-info/top_level.txt +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_agent_idp.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_agent_idp_keys.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_agent_plugin.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_cache_hotfix.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_cache_verification.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_commit_action_limit.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_compat_constants_completeness.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_compat_delete_files.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_compat_get_model_files.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_compat_snapshot_download.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_compat_studio.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_config_token.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_create_repo_routing.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_credential_lifecycle.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_dataset_category.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_download_corruption.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_download_lock_path.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_download_report.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_errors_openapi_codes.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_legacy_cache_detection.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_login_failure_paths.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_login_scoped_token.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_model_category.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_model_detail_fields.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_model_options.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_openapi_coverage.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_openapi_delete_files.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_repo_files_truncation.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_repo_info_visibility.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_repo_tree_page_retry.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_upload_batching.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_upload_blob_dedup.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_upload_config.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_upload_lfs_gate.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_user_agent.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_user_info.py +0 -0
- {modelscope_hub-0.7.0 → modelscope_hub-0.7.2}/tests/test_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: modelscope-hub
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: The official Python client to connect with ModelScope Hub.
|
|
5
5
|
Author: ModelScope team
|
|
6
6
|
Author-email: contact@modelscope.cn
|
|
@@ -69,12 +69,60 @@ The official Python SDK & CLI for [ModelScope Hub](https://modelscope.cn) — do
|
|
|
69
69
|
|
|
70
70
|
## News
|
|
71
71
|
|
|
72
|
+
**v0.7.2** (2026-11-24)
|
|
73
|
+
- **Fix**: download counting — a snapshot download (`download_repo`, `snapshot_download`, `ms-hub download`, report mode) sends one `snapshot-identifier` per task, shared by every file, retry, resumed transfer and range part, instead of a new one per file; a resumed report-mode task keeps its identifier. Standalone file downloads (`download_file`, `model_file_download`, `dataset_file_download`, CLI file arguments) no longer send one, so the Hub counts them per file. Cached dataset meta files no longer trigger a download request
|
|
74
|
+
|
|
75
|
+
**v0.7.1** (2026-11-10)
|
|
76
|
+
- **Fix**: the intra-cloud region probe is bounded per hop by `MODELSCOPE_DOWNLOAD_REGION_PROBE_TIMEOUT_SECONDS` (default `1`), so a slow probe falls back to the default route instead of stalling the download
|
|
77
|
+
|
|
78
|
+
**v0.7.0** (2026-11-09)
|
|
79
|
+
- **Feature**: `modelscope_hub.kernels` loads optimized kernels from ModelScope (`kernels` extra); `modelscope_hub.compat.hf_hub_patcher` redirects `huggingface_hub` calls to ModelScope (`hf` extra); uploads route through the commit API instead of a git clone + push
|
|
80
|
+
- **Enhance**: offline cache compatibility — `resolve_cached_snapshot` and `local_files_only` resolve standard and legacy cache layouts without network access or writes, legacy model-root links keep pre-snapshot paths valid, `ms-hub cache clear` validates scope and supports `--dry-run`, and `MODELSCOPE_CACHE` takes precedence over the `MS_CACHE_HOME` alias
|
|
81
|
+
|
|
82
|
+
<details>
|
|
83
|
+
<summary>v0.6.1 and older</summary>
|
|
84
|
+
|
|
72
85
|
**v0.6.1** (2026-10-30)
|
|
73
86
|
- **Feature**: `ms-hub download --total-timeout` (and `HubApi(download_total_timeout=...)`) sets a per-file time budget that overrides the environment variable; `0` means no limit
|
|
74
87
|
- **Behaviour**: a transfer that keeps making progress is no longer capped by default — `MODELSCOPE_DOWNLOAD_TOTAL_TIMEOUT` now defaults to `0` (was `3600`), while idle timeouts, the low-speed watchdog and bounded retries still apply; set a positive value to restore a cap
|
|
75
88
|
- **Fix**: a stop caused by an expired budget keeps its partial data and is reported as pending, so a plain re-run resumes it instead of requiring `--retry-failed`; trickling response headers stay bounded by the idle timeout when no overall budget is set
|
|
76
89
|
- **Quality**: budget and cancellation messages are English and name both the budget and the variable that relaxes it
|
|
77
90
|
|
|
91
|
+
**v0.6.0** (2026-10-29)
|
|
92
|
+
- **Feature**: model and dataset writes moved to OpenAPI — repository creation, category set/update, detail reads, model option lists and repository settings; `get_model`/`get_dataset` keep the historical `Visibility` enum, while `gated_mode=True/False` is the separate application switch
|
|
93
|
+
- **Breaking**: `approval_mode`, the `gated` request parameter and `--approval-mode` are removed; passing them through `**kwargs` raises `TypeError` before any request
|
|
94
|
+
- **Enhance**: creation keeps the v0.5.1 legacy request format when `gated_mode` is explicit, and category/zone and set-only fields are validated before sending
|
|
95
|
+
|
|
96
|
+
**v0.5.1** (2026-10-26)
|
|
97
|
+
- **Feature**: `HubApi.download_repo_report` and `ms-hub download --continue-on-error` continue past isolated file failures and return a `COMPLETE`/`PARTIAL` report; `--retry-failed` reruns them and exit code `3` means partial. `download_repo` and `snapshot_download` stay strict
|
|
98
|
+
- **Enhance**: recovery hints live in one hidden JSON per task (no embedded database), state is advisory and re-validated against actual size/hash, failed pages are isolated, and listings stream with bounded queues
|
|
99
|
+
|
|
100
|
+
**v0.5.0** (2026-10-24)
|
|
101
|
+
- **Feature**: downloads verify size and SHA-256 before replacing files, with safe resume, bounded retries, idle and total timeouts, low-speed detection, cancellation and per-file locks; an incomplete snapshot raises `FileDownloadError` (CLI exit code `1`) and keeps completed files
|
|
102
|
+
- **Enhance**: every request sends the same `modelscope_hub/<version>` User-Agent, with custom information appended and CLI/compat markers propagated; errors name the next step
|
|
103
|
+
- **Behaviour**: downloads and listings honour the new `MODELSCOPE_DOWNLOAD_*` and `MODELSCOPE_REPO_TREE_PAGE_*` variables listed in the environment-variable table
|
|
104
|
+
|
|
105
|
+
**v0.4.6** (2026-10-09)
|
|
106
|
+
- **Fix**: cross-region downloads cache a confirmed OSS-internal resolution per storage route (repository, revision and redirect endpoint) and probe routes in parallel, so a metadata route miss no longer suppresses the LFS probe or stalls the transfer
|
|
107
|
+
|
|
108
|
+
**v0.4.5** (2026-09-21)
|
|
109
|
+
- **Feature**: `ms agent install -r owner/name` installs an agent through a framework plugin published as a model repository, gated three times — explicit `--plugin-repo`/`MODELSCOPE_AGENT_PLUGIN_REPO`, a case-sensitive owner allow-list checked before any request, and a non-persisted trust prompt showing the manifest digest
|
|
110
|
+
- **Enhance**: upload recovery retries commit-only failures without re-uploading blobs, splits policy rejections down to single files, aborts after three fully failed batches with a resumable tracker, and only warns about capacity limits
|
|
111
|
+
- **Fix**: an `HTTP 200` create-commit answer carrying `Success:false` is reported as an error instead of a silent success
|
|
112
|
+
|
|
113
|
+
**v0.4.4** (2026-09-20)
|
|
114
|
+
- **Feature**: commit batching — at most `UPLOAD_COMMIT_BATCH_MAX_OPERATIONS` (256) actions and an 8 MiB estimated request body per commit, clamped to the server's 2000-action ceiling, with LFS pointers excluded from the body budget; oversized inline files get their own batch, and `path_in_repo` is normalised consistently below the API layer
|
|
115
|
+
- **Fix**: a repository tree page answering `403` mid-enumeration is retried instead of aborting a listing that spans hundreds of requests
|
|
116
|
+
|
|
117
|
+
**v0.4.3** (2026-09-15)
|
|
118
|
+
- **Fix**: an agent list answering `200` with `OperationNotAllowed` is reported as a permission error instead of an empty result; MCP list replies with legacy `200` + `success:false` envelopes are decoded as errors
|
|
119
|
+
|
|
120
|
+
**v0.4.2** (2026-09-10)
|
|
121
|
+
- **Feature**: `delete_files` on `HubApi` and the compat `HubApi` deletes explicit paths or glob patterns resolved against the remote file list, applied as commit `delete` actions
|
|
122
|
+
|
|
123
|
+
**v0.4.1** (2026-09-09)
|
|
124
|
+
- **Feature**: deletions go through the commit path like uploads (`delete_files` on the commit manager), because the direct repository DELETE endpoint rejects API-token authentication
|
|
125
|
+
|
|
78
126
|
**v0.4.0** (2026-09-01)
|
|
79
127
|
- **Feature**: complete OpenAPI coverage for Agent-IDP, MCP, and Studios — Agent Ed25519 identities, OIDC discovery/JWKS and signed JWT issuance (`HubApi`, `ms-hub agent-idp`); Studio lists, variables and configuration options; hosted MCP discovery; protected visibility and runtime metadata; read-only tokens can log in and rejected writes name the required tier. Agent private JWKs are only written to an explicitly requested owner-only file.
|
|
80
128
|
- **Fix**: Studio compat calls no longer leak connection options or API tokens, or drop cover images; errors distinguish permission, quota and conflicts; anonymous Studio info and log pagination work
|
|
@@ -89,9 +137,6 @@ The official Python SDK & CLI for [ModelScope Hub](https://modelscope.cn) — do
|
|
|
89
137
|
- **Feature**: this package owns all four console scripts (`modelscope`, `ms`, `modelscope-hub`, `ms-hub`), adds `HubApi.get_current_username()`, and supports both agent visibility wire formats
|
|
90
138
|
- **Fix**: large `repo/files` listings are re-enumerated when the server silently truncates results
|
|
91
139
|
|
|
92
|
-
<details>
|
|
93
|
-
<summary>Older releases</summary>
|
|
94
|
-
|
|
95
140
|
**v0.2.0** (2026-08-01)
|
|
96
141
|
- **Breaking**: `HubApi.login()` now raises `NetworkError` / `ServerError` / `RequestTimeoutError` for non-authentication failures instead of always raising `AuthenticationError` — widen `except AuthenticationError` to `HubError` if you catch *any* login failure
|
|
97
142
|
- **Fix**: network, timeout and 5xx errors during login are no longer misreported as an invalid token; a failed login no longer deletes stored credentials; bare and upper-case endpoints are accepted (e.g. `--endpoint modelscope.ai`)
|
|
@@ -255,6 +300,10 @@ path = api.download_file("Qwen/Qwen3-0.6B", "model", "config.json", local_files_
|
|
|
255
300
|
|
|
256
301
|
Downloads validate available size and SHA-256 metadata before replacing files, with safe resume, bounded retries, timeouts, and cancellation. Incomplete snapshots raise `FileDownloadError` (CLI exit code `1`), preserving completed files for subsequent retries.
|
|
257
302
|
|
|
303
|
+
Download counting: each `download_repo` / `snapshot_download` call is one snapshot download. Every file request it makes, including retries, resumed transfers and range parts, carries the same `snapshot-identifier`. The dataset service deduplicates this identifier for two hours; standalone `download_file` calls send no identifier and use fractional per-file counting. Cached files issue no download requests.
|
|
304
|
+
|
|
305
|
+
The dataset count is recorded at the first eligible file request, not when the whole download succeeds; filtered snapshots can count as one download, and cancellation does not roll it back. The server's asynchronous updates and two-hour deduplication TTL do not provide exactly-once counting for arbitrary task durations. Model and archive counting use separate server logic.
|
|
306
|
+
|
|
258
307
|
### Load kernels (`modelscope_hub.kernels`)
|
|
259
308
|
|
|
260
309
|
`modelscope_hub.kernels` is a drop-in wrapper around the [`kernels`](https://github.com/huggingface/kernels) library that downloads optimized compute kernels from ModelScope instead of the Hugging Face Hub. A kernel repository is an ordinary ModelScope model repository mirroring the HF kernel layout (`build/<variant>/...` plus `v1`-style version branches or tags):
|
|
@@ -270,13 +319,13 @@ from modelscope_hub.kernels import get_kernel
|
|
|
270
319
|
activation = get_kernel("kernels-community/activation", version=1)
|
|
271
320
|
```
|
|
272
321
|
|
|
273
|
-
Also available: `has_kernel()` (environment compatibility check), `get_kernel_variants()` (build-variant decisions), `get_local_kernel()` (load from a local path, dependencies from ModelScope), `install_kernel()` (download to the local cache without importing — CI pre-installation / offline preparation), `install_kernel_all_variants()` (download every build variant plus the dependency tree), `get_locked_kernel()` (load a kernel pinned by a lockfile, downloading missing pieces), and `load_kernel()` (import an already-installed locked kernel; never downloads). Under `patch_kernels_hub()` every other networked `kernels` entry point (the `layer`/`kernelize` APIs, benchmarks, etc.) is redirected the same way, because the whole library routes through one Hub API factory.
|
|
322
|
+
Also available: `has_kernel()` (environment compatibility check), `get_kernel_variants()` (build-variant decisions), `get_local_kernel()` (load from a local path, dependencies from ModelScope), `install_kernel()` (download to the local cache without importing — CI pre-installation / offline preparation), `install_kernel_all_variants()` (download every build variant plus the dependency tree), `lock_kernels()` (resolve the dependency tree against ModelScope and write a `kernels.lock` file — the in-process equivalent of `kernels lock`), `get_locked_kernel()` (load a kernel pinned by a lockfile, downloading missing pieces), and `load_kernel()` (import an already-installed locked kernel; never downloads). The same lockfile can be created from the command line with `ms-hub kernels lock [project_dir]`, which reads `[tool.kernels.dependencies]` from `pyproject.toml`. Under `patch_kernels_hub()` every other networked `kernels` entry point (the `layer`/`kernelize` APIs, benchmarks, etc.) is redirected the same way, because the whole library routes through one Hub API factory. The upstream `kernels lock` console script runs in its own process and therefore cannot pick up the in-process patch; use `lock_kernels()` or `ms-hub kernels lock` instead.
|
|
274
323
|
|
|
275
324
|
Notes:
|
|
276
325
|
|
|
277
326
|
- The kernel loading, variant resolution, and dependency logic of `kernels` are reused unchanged — only its Hub API factory is swapped for a ModelScope-backed shim while a `modelscope_hub.kernels` call is in flight, so a plain `import kernels` elsewhere keeps using the Hugging Face Hub. `patch_kernels_hub()` / `unpatch_kernels_hub()` / `patch_scope()` switch this explicitly if you need it globally; the `modelscope` package's `patch_hub()` builds on the same implementation.
|
|
278
327
|
- `version=N` resolves against the repository's `v<N>` branches/tags. A mirror that only carries `master` exposes it as kernel version `v1` automatically.
|
|
279
|
-
- Kernel lockfiles record hub-specific commit hashes: a lockfile created against the Hugging Face Hub cannot resolve on ModelScope (the two hubs have different git histories). Create the lockfile in the ModelScope environment (`
|
|
328
|
+
- Kernel lockfiles record hub-specific commit hashes: a lockfile created against the Hugging Face Hub cannot resolve on ModelScope (the two hubs have different git histories). Create the lockfile in the ModelScope environment (`lock_kernels()`, `install_kernel_all_variants`, or `ms-hub kernels lock`) so it records ModelScope commits; a commit-hash revision that cannot be found raises with a note explaining this.
|
|
280
329
|
- ModelScope has no trusted-publisher flag, so untrusted publishers are rejected by default: only `kernels-community` is trusted out of the box. Extend the allowlist with `MS_KERNELS_TRUSTED_PUBLISHERS` (comma-separated), or allow specific repositories / all repositories through the trust parameters of `get_kernel` (its docstring mirrors the kernel library's API).
|
|
281
330
|
- The mirror must contain kernels built for your exact Torch version and platform (`kernels` selects `build/torchXY-...-<cpu>-<os>/`); a repository whose builds predate `kernels` 0.17 metadata cannot be loaded until it is rebuilt with a current `kernel-builder`.
|
|
282
331
|
|
|
@@ -301,6 +350,7 @@ report.close() # Release temporary per-file results after consumption.
|
|
|
301
350
|
|
|
302
351
|
- Recovery defaults: at most **2 extra retries per file**, shared by range parts and integrity recovery; failed-request inactivity and waits have a **60-second cumulative budget**. Idle/header waits are limited to **15 seconds**, low-speed checks use a **10-second window**, and cooldowns longer than **5 seconds** defer the file instead of tying up a worker. Size/hash mismatches get at most one full re-download. Healthy transfer time is **not** capped by default: a transfer that keeps making progress runs to completion, and `MODELSCOPE_DOWNLOAD_TOTAL_TIMEOUT` only applies when set to a positive value.
|
|
303
352
|
- Each task uses **one hidden JSON file** outside downloaded contents (`cache_dir/.download_state/.ms_download_<key>.json` by default), with no embedded database dependency. It combines sparse failures, recovery budgets, failed pages, and the latest call's summary under `report`; `report.report_path` equals `report.tracker_path`. Reruns and batches replace the same file, without extra report JSON or JSONL files. Successful files have no persistent per-file records; a healthy run writes only its scope header and final summary, not an update per file. Its scope is endpoint/repository/revision/output, independent of batch filters. Standard reusable lock files remain separate from JSON metadata.
|
|
353
|
+
- The same JSON keeps the task's `snapshot-identifier`: reruns of an unfinished task (`PARTIAL` or `CANCELLED`) reuse it, so the dataset service can deduplicate resumed requests within its two-hour window; the run after a `COMPLETE` one starts a new task. Keeping it adds no writes beyond the scope header, exceptional records and the final summary.
|
|
304
354
|
- State is advisory, never the sole evidence of success. Every rerun validates actual files against current size/hash metadata, even if hints say `FAILED` or `DEFERRED`; a repaired valid file clears its stale hint without network IO. Otherwise failures remain isolated until metadata changes or `retry_failed=True`. Missing or corrupt hints allow bounded fresh recovery; load/write problems are logged and exposed in `report.state_warnings`, not treated as data corruption or success. A crash during recovery preserves its budget if hints were saved; healthy in-flight files need no markers and resume from actual partial files. Old database-format trackers are not read or migrated: select a new JSON path; existing correct data is reused through validation.
|
|
305
355
|
- Dataset pages are streamed with bounded queues. Failed pages are recorded and isolated across calls; later pages/roots can continue. Two consecutive failed pages stop that root, and `listing_complete=False` prevents false success. The next run can use `retry_failed=True` or an authoritative `file_list` iterable to recover incomplete enumeration. Model listings that hit an unrecoverable server cap also return a partial report.
|
|
306
356
|
- Counts and `report.iter_files()` cover **this call's selection**. Per-file results stream from an anonymous temporary spool owned by the live report, so earlier report objects remain independent of later batches without permanent manifests or an in-memory list of every file. Call `report.close()` after consumption; garbage collection also releases its spool. `results_path` is empty. The single JSON retains only the latest summary, not historical reports or a verified-file manifest: reconstructing a report from it cannot provide per-file results; rerun actual-file validation instead. Aggregate batch counts for the whole migration. Only `VERIFIED` entries may be uploaded; changed files must be checked again before use, and partial reports must not authorize deleting source data. A pinned revision or authoritative manifest is recommended. Reuse the same tracker and output across ten-file batches; a tracker cannot be shared by simultaneous writers.
|
|
@@ -1141,6 +1191,7 @@ Token is persisted locally after `ms-hub login` and auto-loaded in subsequent se
|
|
|
1141
1191
|
| `MODELSCOPE_DOWNLOAD_FILE_LOCK` | `true` | File lock for multiprocess download safety |
|
|
1142
1192
|
| `MODELSCOPE_DOWNLOAD_INTRA_CLOUD` | `true` | Alibaba cloud intra-cloud acceleration |
|
|
1143
1193
|
| `MODELSCOPE_DOWNLOAD_INTRA_CLOUD_REGION` | (auto) | Override intra-cloud region ID |
|
|
1194
|
+
| `MODELSCOPE_DOWNLOAD_REGION_PROBE_TIMEOUT_SECONDS` | `1` | Per-hop timeout for the intra-cloud region probe (seconds) |
|
|
1144
1195
|
| `MODELSCOPE_DOWNLOAD_INTER_CLOUD_REGIONS` | | Comma-separated peer regions for cross-region internal acceleration (e.g. `cn-hangzhou,cn-zhangjiakou`) |
|
|
1145
1196
|
|
|
1146
1197
|
**Upload:**
|
|
@@ -33,12 +33,60 @@ The official Python SDK & CLI for [ModelScope Hub](https://modelscope.cn) — do
|
|
|
33
33
|
|
|
34
34
|
## News
|
|
35
35
|
|
|
36
|
+
**v0.7.2** (2026-11-24)
|
|
37
|
+
- **Fix**: download counting — a snapshot download (`download_repo`, `snapshot_download`, `ms-hub download`, report mode) sends one `snapshot-identifier` per task, shared by every file, retry, resumed transfer and range part, instead of a new one per file; a resumed report-mode task keeps its identifier. Standalone file downloads (`download_file`, `model_file_download`, `dataset_file_download`, CLI file arguments) no longer send one, so the Hub counts them per file. Cached dataset meta files no longer trigger a download request
|
|
38
|
+
|
|
39
|
+
**v0.7.1** (2026-11-10)
|
|
40
|
+
- **Fix**: the intra-cloud region probe is bounded per hop by `MODELSCOPE_DOWNLOAD_REGION_PROBE_TIMEOUT_SECONDS` (default `1`), so a slow probe falls back to the default route instead of stalling the download
|
|
41
|
+
|
|
42
|
+
**v0.7.0** (2026-11-09)
|
|
43
|
+
- **Feature**: `modelscope_hub.kernels` loads optimized kernels from ModelScope (`kernels` extra); `modelscope_hub.compat.hf_hub_patcher` redirects `huggingface_hub` calls to ModelScope (`hf` extra); uploads route through the commit API instead of a git clone + push
|
|
44
|
+
- **Enhance**: offline cache compatibility — `resolve_cached_snapshot` and `local_files_only` resolve standard and legacy cache layouts without network access or writes, legacy model-root links keep pre-snapshot paths valid, `ms-hub cache clear` validates scope and supports `--dry-run`, and `MODELSCOPE_CACHE` takes precedence over the `MS_CACHE_HOME` alias
|
|
45
|
+
|
|
46
|
+
<details>
|
|
47
|
+
<summary>v0.6.1 and older</summary>
|
|
48
|
+
|
|
36
49
|
**v0.6.1** (2026-10-30)
|
|
37
50
|
- **Feature**: `ms-hub download --total-timeout` (and `HubApi(download_total_timeout=...)`) sets a per-file time budget that overrides the environment variable; `0` means no limit
|
|
38
51
|
- **Behaviour**: a transfer that keeps making progress is no longer capped by default — `MODELSCOPE_DOWNLOAD_TOTAL_TIMEOUT` now defaults to `0` (was `3600`), while idle timeouts, the low-speed watchdog and bounded retries still apply; set a positive value to restore a cap
|
|
39
52
|
- **Fix**: a stop caused by an expired budget keeps its partial data and is reported as pending, so a plain re-run resumes it instead of requiring `--retry-failed`; trickling response headers stay bounded by the idle timeout when no overall budget is set
|
|
40
53
|
- **Quality**: budget and cancellation messages are English and name both the budget and the variable that relaxes it
|
|
41
54
|
|
|
55
|
+
**v0.6.0** (2026-10-29)
|
|
56
|
+
- **Feature**: model and dataset writes moved to OpenAPI — repository creation, category set/update, detail reads, model option lists and repository settings; `get_model`/`get_dataset` keep the historical `Visibility` enum, while `gated_mode=True/False` is the separate application switch
|
|
57
|
+
- **Breaking**: `approval_mode`, the `gated` request parameter and `--approval-mode` are removed; passing them through `**kwargs` raises `TypeError` before any request
|
|
58
|
+
- **Enhance**: creation keeps the v0.5.1 legacy request format when `gated_mode` is explicit, and category/zone and set-only fields are validated before sending
|
|
59
|
+
|
|
60
|
+
**v0.5.1** (2026-10-26)
|
|
61
|
+
- **Feature**: `HubApi.download_repo_report` and `ms-hub download --continue-on-error` continue past isolated file failures and return a `COMPLETE`/`PARTIAL` report; `--retry-failed` reruns them and exit code `3` means partial. `download_repo` and `snapshot_download` stay strict
|
|
62
|
+
- **Enhance**: recovery hints live in one hidden JSON per task (no embedded database), state is advisory and re-validated against actual size/hash, failed pages are isolated, and listings stream with bounded queues
|
|
63
|
+
|
|
64
|
+
**v0.5.0** (2026-10-24)
|
|
65
|
+
- **Feature**: downloads verify size and SHA-256 before replacing files, with safe resume, bounded retries, idle and total timeouts, low-speed detection, cancellation and per-file locks; an incomplete snapshot raises `FileDownloadError` (CLI exit code `1`) and keeps completed files
|
|
66
|
+
- **Enhance**: every request sends the same `modelscope_hub/<version>` User-Agent, with custom information appended and CLI/compat markers propagated; errors name the next step
|
|
67
|
+
- **Behaviour**: downloads and listings honour the new `MODELSCOPE_DOWNLOAD_*` and `MODELSCOPE_REPO_TREE_PAGE_*` variables listed in the environment-variable table
|
|
68
|
+
|
|
69
|
+
**v0.4.6** (2026-10-09)
|
|
70
|
+
- **Fix**: cross-region downloads cache a confirmed OSS-internal resolution per storage route (repository, revision and redirect endpoint) and probe routes in parallel, so a metadata route miss no longer suppresses the LFS probe or stalls the transfer
|
|
71
|
+
|
|
72
|
+
**v0.4.5** (2026-09-21)
|
|
73
|
+
- **Feature**: `ms agent install -r owner/name` installs an agent through a framework plugin published as a model repository, gated three times — explicit `--plugin-repo`/`MODELSCOPE_AGENT_PLUGIN_REPO`, a case-sensitive owner allow-list checked before any request, and a non-persisted trust prompt showing the manifest digest
|
|
74
|
+
- **Enhance**: upload recovery retries commit-only failures without re-uploading blobs, splits policy rejections down to single files, aborts after three fully failed batches with a resumable tracker, and only warns about capacity limits
|
|
75
|
+
- **Fix**: an `HTTP 200` create-commit answer carrying `Success:false` is reported as an error instead of a silent success
|
|
76
|
+
|
|
77
|
+
**v0.4.4** (2026-09-20)
|
|
78
|
+
- **Feature**: commit batching — at most `UPLOAD_COMMIT_BATCH_MAX_OPERATIONS` (256) actions and an 8 MiB estimated request body per commit, clamped to the server's 2000-action ceiling, with LFS pointers excluded from the body budget; oversized inline files get their own batch, and `path_in_repo` is normalised consistently below the API layer
|
|
79
|
+
- **Fix**: a repository tree page answering `403` mid-enumeration is retried instead of aborting a listing that spans hundreds of requests
|
|
80
|
+
|
|
81
|
+
**v0.4.3** (2026-09-15)
|
|
82
|
+
- **Fix**: an agent list answering `200` with `OperationNotAllowed` is reported as a permission error instead of an empty result; MCP list replies with legacy `200` + `success:false` envelopes are decoded as errors
|
|
83
|
+
|
|
84
|
+
**v0.4.2** (2026-09-10)
|
|
85
|
+
- **Feature**: `delete_files` on `HubApi` and the compat `HubApi` deletes explicit paths or glob patterns resolved against the remote file list, applied as commit `delete` actions
|
|
86
|
+
|
|
87
|
+
**v0.4.1** (2026-09-09)
|
|
88
|
+
- **Feature**: deletions go through the commit path like uploads (`delete_files` on the commit manager), because the direct repository DELETE endpoint rejects API-token authentication
|
|
89
|
+
|
|
42
90
|
**v0.4.0** (2026-09-01)
|
|
43
91
|
- **Feature**: complete OpenAPI coverage for Agent-IDP, MCP, and Studios — Agent Ed25519 identities, OIDC discovery/JWKS and signed JWT issuance (`HubApi`, `ms-hub agent-idp`); Studio lists, variables and configuration options; hosted MCP discovery; protected visibility and runtime metadata; read-only tokens can log in and rejected writes name the required tier. Agent private JWKs are only written to an explicitly requested owner-only file.
|
|
44
92
|
- **Fix**: Studio compat calls no longer leak connection options or API tokens, or drop cover images; errors distinguish permission, quota and conflicts; anonymous Studio info and log pagination work
|
|
@@ -53,9 +101,6 @@ The official Python SDK & CLI for [ModelScope Hub](https://modelscope.cn) — do
|
|
|
53
101
|
- **Feature**: this package owns all four console scripts (`modelscope`, `ms`, `modelscope-hub`, `ms-hub`), adds `HubApi.get_current_username()`, and supports both agent visibility wire formats
|
|
54
102
|
- **Fix**: large `repo/files` listings are re-enumerated when the server silently truncates results
|
|
55
103
|
|
|
56
|
-
<details>
|
|
57
|
-
<summary>Older releases</summary>
|
|
58
|
-
|
|
59
104
|
**v0.2.0** (2026-08-01)
|
|
60
105
|
- **Breaking**: `HubApi.login()` now raises `NetworkError` / `ServerError` / `RequestTimeoutError` for non-authentication failures instead of always raising `AuthenticationError` — widen `except AuthenticationError` to `HubError` if you catch *any* login failure
|
|
61
106
|
- **Fix**: network, timeout and 5xx errors during login are no longer misreported as an invalid token; a failed login no longer deletes stored credentials; bare and upper-case endpoints are accepted (e.g. `--endpoint modelscope.ai`)
|
|
@@ -219,6 +264,10 @@ path = api.download_file("Qwen/Qwen3-0.6B", "model", "config.json", local_files_
|
|
|
219
264
|
|
|
220
265
|
Downloads validate available size and SHA-256 metadata before replacing files, with safe resume, bounded retries, timeouts, and cancellation. Incomplete snapshots raise `FileDownloadError` (CLI exit code `1`), preserving completed files for subsequent retries.
|
|
221
266
|
|
|
267
|
+
Download counting: each `download_repo` / `snapshot_download` call is one snapshot download. Every file request it makes, including retries, resumed transfers and range parts, carries the same `snapshot-identifier`. The dataset service deduplicates this identifier for two hours; standalone `download_file` calls send no identifier and use fractional per-file counting. Cached files issue no download requests.
|
|
268
|
+
|
|
269
|
+
The dataset count is recorded at the first eligible file request, not when the whole download succeeds; filtered snapshots can count as one download, and cancellation does not roll it back. The server's asynchronous updates and two-hour deduplication TTL do not provide exactly-once counting for arbitrary task durations. Model and archive counting use separate server logic.
|
|
270
|
+
|
|
222
271
|
### Load kernels (`modelscope_hub.kernels`)
|
|
223
272
|
|
|
224
273
|
`modelscope_hub.kernels` is a drop-in wrapper around the [`kernels`](https://github.com/huggingface/kernels) library that downloads optimized compute kernels from ModelScope instead of the Hugging Face Hub. A kernel repository is an ordinary ModelScope model repository mirroring the HF kernel layout (`build/<variant>/...` plus `v1`-style version branches or tags):
|
|
@@ -234,13 +283,13 @@ from modelscope_hub.kernels import get_kernel
|
|
|
234
283
|
activation = get_kernel("kernels-community/activation", version=1)
|
|
235
284
|
```
|
|
236
285
|
|
|
237
|
-
Also available: `has_kernel()` (environment compatibility check), `get_kernel_variants()` (build-variant decisions), `get_local_kernel()` (load from a local path, dependencies from ModelScope), `install_kernel()` (download to the local cache without importing — CI pre-installation / offline preparation), `install_kernel_all_variants()` (download every build variant plus the dependency tree), `get_locked_kernel()` (load a kernel pinned by a lockfile, downloading missing pieces), and `load_kernel()` (import an already-installed locked kernel; never downloads). Under `patch_kernels_hub()` every other networked `kernels` entry point (the `layer`/`kernelize` APIs, benchmarks, etc.) is redirected the same way, because the whole library routes through one Hub API factory.
|
|
286
|
+
Also available: `has_kernel()` (environment compatibility check), `get_kernel_variants()` (build-variant decisions), `get_local_kernel()` (load from a local path, dependencies from ModelScope), `install_kernel()` (download to the local cache without importing — CI pre-installation / offline preparation), `install_kernel_all_variants()` (download every build variant plus the dependency tree), `lock_kernels()` (resolve the dependency tree against ModelScope and write a `kernels.lock` file — the in-process equivalent of `kernels lock`), `get_locked_kernel()` (load a kernel pinned by a lockfile, downloading missing pieces), and `load_kernel()` (import an already-installed locked kernel; never downloads). The same lockfile can be created from the command line with `ms-hub kernels lock [project_dir]`, which reads `[tool.kernels.dependencies]` from `pyproject.toml`. Under `patch_kernels_hub()` every other networked `kernels` entry point (the `layer`/`kernelize` APIs, benchmarks, etc.) is redirected the same way, because the whole library routes through one Hub API factory. The upstream `kernels lock` console script runs in its own process and therefore cannot pick up the in-process patch; use `lock_kernels()` or `ms-hub kernels lock` instead.
|
|
238
287
|
|
|
239
288
|
Notes:
|
|
240
289
|
|
|
241
290
|
- The kernel loading, variant resolution, and dependency logic of `kernels` are reused unchanged — only its Hub API factory is swapped for a ModelScope-backed shim while a `modelscope_hub.kernels` call is in flight, so a plain `import kernels` elsewhere keeps using the Hugging Face Hub. `patch_kernels_hub()` / `unpatch_kernels_hub()` / `patch_scope()` switch this explicitly if you need it globally; the `modelscope` package's `patch_hub()` builds on the same implementation.
|
|
242
291
|
- `version=N` resolves against the repository's `v<N>` branches/tags. A mirror that only carries `master` exposes it as kernel version `v1` automatically.
|
|
243
|
-
- Kernel lockfiles record hub-specific commit hashes: a lockfile created against the Hugging Face Hub cannot resolve on ModelScope (the two hubs have different git histories). Create the lockfile in the ModelScope environment (`
|
|
292
|
+
- Kernel lockfiles record hub-specific commit hashes: a lockfile created against the Hugging Face Hub cannot resolve on ModelScope (the two hubs have different git histories). Create the lockfile in the ModelScope environment (`lock_kernels()`, `install_kernel_all_variants`, or `ms-hub kernels lock`) so it records ModelScope commits; a commit-hash revision that cannot be found raises with a note explaining this.
|
|
244
293
|
- ModelScope has no trusted-publisher flag, so untrusted publishers are rejected by default: only `kernels-community` is trusted out of the box. Extend the allowlist with `MS_KERNELS_TRUSTED_PUBLISHERS` (comma-separated), or allow specific repositories / all repositories through the trust parameters of `get_kernel` (its docstring mirrors the kernel library's API).
|
|
245
294
|
- The mirror must contain kernels built for your exact Torch version and platform (`kernels` selects `build/torchXY-...-<cpu>-<os>/`); a repository whose builds predate `kernels` 0.17 metadata cannot be loaded until it is rebuilt with a current `kernel-builder`.
|
|
246
295
|
|
|
@@ -265,6 +314,7 @@ report.close() # Release temporary per-file results after consumption.
|
|
|
265
314
|
|
|
266
315
|
- Recovery defaults: at most **2 extra retries per file**, shared by range parts and integrity recovery; failed-request inactivity and waits have a **60-second cumulative budget**. Idle/header waits are limited to **15 seconds**, low-speed checks use a **10-second window**, and cooldowns longer than **5 seconds** defer the file instead of tying up a worker. Size/hash mismatches get at most one full re-download. Healthy transfer time is **not** capped by default: a transfer that keeps making progress runs to completion, and `MODELSCOPE_DOWNLOAD_TOTAL_TIMEOUT` only applies when set to a positive value.
|
|
267
316
|
- Each task uses **one hidden JSON file** outside downloaded contents (`cache_dir/.download_state/.ms_download_<key>.json` by default), with no embedded database dependency. It combines sparse failures, recovery budgets, failed pages, and the latest call's summary under `report`; `report.report_path` equals `report.tracker_path`. Reruns and batches replace the same file, without extra report JSON or JSONL files. Successful files have no persistent per-file records; a healthy run writes only its scope header and final summary, not an update per file. Its scope is endpoint/repository/revision/output, independent of batch filters. Standard reusable lock files remain separate from JSON metadata.
|
|
317
|
+
- The same JSON keeps the task's `snapshot-identifier`: reruns of an unfinished task (`PARTIAL` or `CANCELLED`) reuse it, so the dataset service can deduplicate resumed requests within its two-hour window; the run after a `COMPLETE` one starts a new task. Keeping it adds no writes beyond the scope header, exceptional records and the final summary.
|
|
268
318
|
- State is advisory, never the sole evidence of success. Every rerun validates actual files against current size/hash metadata, even if hints say `FAILED` or `DEFERRED`; a repaired valid file clears its stale hint without network IO. Otherwise failures remain isolated until metadata changes or `retry_failed=True`. Missing or corrupt hints allow bounded fresh recovery; load/write problems are logged and exposed in `report.state_warnings`, not treated as data corruption or success. A crash during recovery preserves its budget if hints were saved; healthy in-flight files need no markers and resume from actual partial files. Old database-format trackers are not read or migrated: select a new JSON path; existing correct data is reused through validation.
|
|
269
319
|
- Dataset pages are streamed with bounded queues. Failed pages are recorded and isolated across calls; later pages/roots can continue. Two consecutive failed pages stop that root, and `listing_complete=False` prevents false success. The next run can use `retry_failed=True` or an authoritative `file_list` iterable to recover incomplete enumeration. Model listings that hit an unrecoverable server cap also return a partial report.
|
|
270
320
|
- Counts and `report.iter_files()` cover **this call's selection**. Per-file results stream from an anonymous temporary spool owned by the live report, so earlier report objects remain independent of later batches without permanent manifests or an in-memory list of every file. Call `report.close()` after consumption; garbage collection also releases its spool. `results_path` is empty. The single JSON retains only the latest summary, not historical reports or a verified-file manifest: reconstructing a report from it cannot provide per-file results; rerun actual-file validation instead. Aggregate batch counts for the whole migration. Only `VERIFIED` entries may be uploaded; changed files must be checked again before use, and partial reports must not authorize deleting source data. A pinned revision or authoritative manifest is recommended. Reuse the same tracker and output across ten-file batches; a tracker cannot be shared by simultaneous writers.
|
|
@@ -1105,6 +1155,7 @@ Token is persisted locally after `ms-hub login` and auto-loaded in subsequent se
|
|
|
1105
1155
|
| `MODELSCOPE_DOWNLOAD_FILE_LOCK` | `true` | File lock for multiprocess download safety |
|
|
1106
1156
|
| `MODELSCOPE_DOWNLOAD_INTRA_CLOUD` | `true` | Alibaba cloud intra-cloud acceleration |
|
|
1107
1157
|
| `MODELSCOPE_DOWNLOAD_INTRA_CLOUD_REGION` | (auto) | Override intra-cloud region ID |
|
|
1158
|
+
| `MODELSCOPE_DOWNLOAD_REGION_PROBE_TIMEOUT_SECONDS` | `1` | Per-hop timeout for the intra-cloud region probe (seconds) |
|
|
1108
1159
|
| `MODELSCOPE_DOWNLOAD_INTER_CLOUD_REGIONS` | | Comma-separated peer regions for cross-region internal acceleration (e.g. `cn-hangzhou,cn-zhangjiakou`) |
|
|
1109
1160
|
|
|
1110
1161
|
**Upload:**
|
|
@@ -105,5 +105,5 @@ strict = false
|
|
|
105
105
|
warn_return_any = false
|
|
106
106
|
|
|
107
107
|
[[tool.mypy.overrides]]
|
|
108
|
-
module = ["tqdm.*", "modelscope.*", "kernels.*", "huggingface_hub.*"]
|
|
108
|
+
module = ["tqdm.*", "modelscope.*", "kernels.*", "huggingface_hub.*", "tomllib", "tomli"]
|
|
109
109
|
ignore_missing_imports = true
|
|
@@ -8,7 +8,7 @@ Supports single-file and whole-repo (snapshot) downloads with:
|
|
|
8
8
|
- Parallel range download (split large files into parts)
|
|
9
9
|
- Per-file download retry with backoff
|
|
10
10
|
- File lock for multiprocess safety
|
|
11
|
-
- User-agent
|
|
11
|
+
- User-agent headers and a task-scoped snapshot identifier
|
|
12
12
|
- Intra-cloud acceleration
|
|
13
13
|
- Local-files-only (offline) mode
|
|
14
14
|
- Custom progress callbacks
|
|
@@ -54,6 +54,7 @@ from .constants import (
|
|
|
54
54
|
DOWNLOAD_PARALLEL_THRESHOLD,
|
|
55
55
|
DOWNLOAD_PARALLELS,
|
|
56
56
|
DOWNLOAD_PART_SIZE,
|
|
57
|
+
DOWNLOAD_REGION_PROBE_TIMEOUT_SECONDS,
|
|
57
58
|
DOWNLOAD_RETRY_MAX_DELAY_SECONDS,
|
|
58
59
|
DOWNLOAD_RETRY_TIMES,
|
|
59
60
|
DOWNLOAD_TIMEOUT,
|
|
@@ -102,6 +103,15 @@ DOWNLOAD_INTEGRITY_RETRY_BACKOFF = 1.0
|
|
|
102
103
|
_DIAGNOSTIC_HEADERS = ("x-oss-request-id", "x-request-id", "eagleid", "x-cache", "x-linked-etag")
|
|
103
104
|
_CONTENT_RANGE_RE = re.compile(r"bytes\s+(\d+)-(\d+)/(\d+|\*)", re.IGNORECASE)
|
|
104
105
|
|
|
106
|
+
# Groups the file requests of one logical repository snapshot download so the Hub
|
|
107
|
+
# counts the task once. Standalone file downloads never send it.
|
|
108
|
+
_SNAPSHOT_IDENTIFIER_HEADER = "snapshot-identifier"
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _new_snapshot_id() -> str:
|
|
112
|
+
"""Return a fresh identifier for one logical repository snapshot download."""
|
|
113
|
+
return uuid.uuid4().hex
|
|
114
|
+
|
|
105
115
|
|
|
106
116
|
# ---------------------------------------------------------------------------
|
|
107
117
|
# Progress callback system
|
|
@@ -653,6 +663,7 @@ class DownloadManager:
|
|
|
653
663
|
# None defers to MODELSCOPE_DOWNLOAD_TOTAL_TIMEOUT; 0 or less means no limit.
|
|
654
664
|
self._total_timeout = total_timeout
|
|
655
665
|
self._cached_region: str | None = None
|
|
666
|
+
self._region_probe_failures = 0
|
|
656
667
|
self._region_lock = threading.Lock()
|
|
657
668
|
# Cache only confirmed OSS-internal resolutions. A repository can contain
|
|
658
669
|
# Git metadata and LFS objects behind different download routes, so cache
|
|
@@ -672,17 +683,34 @@ class DownloadManager:
|
|
|
672
683
|
|
|
673
684
|
return append_user_agent(self._user_agent, user_agent)
|
|
674
685
|
|
|
686
|
+
# A probe that never reached the endpoint says nothing about the machine's
|
|
687
|
+
# location, so the result is not cached and a later call probes again. The
|
|
688
|
+
# budget keeps a broken route from costing a probe timeout on every file.
|
|
689
|
+
_REGION_PROBE_MAX_ATTEMPTS = 2
|
|
690
|
+
|
|
675
691
|
def _detect_region(self) -> str:
|
|
676
|
-
"""Probe the region
|
|
692
|
+
"""Probe the region once per DownloadManager instance.
|
|
693
|
+
|
|
694
|
+
An inconclusive probe (the endpoint never answered) is retried on a
|
|
695
|
+
later call rather than cached: caching it would silently drop
|
|
696
|
+
intra-cloud acceleration for every remaining download of this instance.
|
|
697
|
+
"""
|
|
677
698
|
with self._region_lock:
|
|
678
|
-
if self._cached_region is None:
|
|
699
|
+
if self._cached_region is not None:
|
|
700
|
+
return self._cached_region
|
|
701
|
+
region = self._detect_region_uncached()
|
|
702
|
+
if region is not None:
|
|
703
|
+
self._cached_region = region
|
|
704
|
+
return region
|
|
705
|
+
self._region_probe_failures += 1
|
|
706
|
+
if self._region_probe_failures >= self._REGION_PROBE_MAX_ATTEMPTS:
|
|
679
707
|
self._cached_region = ""
|
|
680
|
-
|
|
681
|
-
return self._cached_region
|
|
708
|
+
return ""
|
|
682
709
|
|
|
683
|
-
def _detect_region_uncached(self) -> str:
|
|
710
|
+
def _detect_region_uncached(self) -> str | None:
|
|
684
711
|
endpoint = self._client.endpoint
|
|
685
712
|
internal_url = f"{endpoint}/api/v1/repos/internalAccelerationInfo"
|
|
713
|
+
timeout = DOWNLOAD_REGION_PROBE_TIMEOUT_SECONDS
|
|
686
714
|
|
|
687
715
|
def _get(url: str, timeout: float):
|
|
688
716
|
try:
|
|
@@ -699,18 +727,20 @@ class DownloadManager:
|
|
|
699
727
|
return None
|
|
700
728
|
|
|
701
729
|
region_id = ""
|
|
702
|
-
resp = _get(internal_url,
|
|
703
|
-
if resp is
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
730
|
+
resp = _get(internal_url, timeout)
|
|
731
|
+
if resp is None:
|
|
732
|
+
# Unreachable endpoint: no conclusion about this machine may be
|
|
733
|
+
# cached, so the caller can probe again on a later call.
|
|
734
|
+
return None
|
|
735
|
+
data = resp.json()
|
|
736
|
+
query_addr = ""
|
|
737
|
+
if "Data" in data:
|
|
738
|
+
query_addr = data["Data"].get("InternalRegionQueryAddress", "")
|
|
739
|
+
if query_addr:
|
|
740
|
+
domain_resp = _get(query_addr, timeout)
|
|
741
|
+
if domain_resp is not None:
|
|
742
|
+
region_id = domain_resp.text.strip()
|
|
743
|
+
|
|
714
744
|
return region_id
|
|
715
745
|
|
|
716
746
|
# OSS internal endpoint hostname pattern:
|
|
@@ -846,14 +876,22 @@ class DownloadManager:
|
|
|
846
876
|
user_agent: dict | str | None = None,
|
|
847
877
|
*,
|
|
848
878
|
accelerate: bool = True,
|
|
879
|
+
snapshot_id: str | None = None,
|
|
849
880
|
) -> dict[str, str]:
|
|
881
|
+
"""Build the headers shared by every attempt of one file transfer.
|
|
882
|
+
|
|
883
|
+
*snapshot_id* identifies the snapshot download the file belongs to and is
|
|
884
|
+
sent verbatim when non-blank. It is never generated here: standalone file
|
|
885
|
+
downloads pass ``None`` and send no snapshot identifier.
|
|
886
|
+
"""
|
|
850
887
|
from .constants import _env, _env_bool
|
|
851
888
|
|
|
852
889
|
headers: dict[str, str] = {
|
|
853
890
|
"user-agent": self._build_user_agent(user_agent),
|
|
854
|
-
"snapshot-identifier": uuid.uuid4().hex,
|
|
855
891
|
"Accept-Encoding": "identity",
|
|
856
892
|
}
|
|
893
|
+
if snapshot_id and snapshot_id.strip():
|
|
894
|
+
headers[_SNAPSHOT_IDENTIFIER_HEADER] = snapshot_id
|
|
857
895
|
if accelerate and _env_bool(ENV_INTRA_CLOUD_ACCELERATION, True):
|
|
858
896
|
region = (_env(ENV_INTRA_CLOUD_REGION, "INTRA_CLOUD_ACCELERATION_REGION") or "").strip()
|
|
859
897
|
if not region:
|
|
@@ -884,8 +922,13 @@ class DownloadManager:
|
|
|
884
922
|
progress_callbacks: list[type[ProgressCallback]] | None = None,
|
|
885
923
|
_cancel_event: threading.Event | None = None,
|
|
886
924
|
_recovery: _RecoveryBudget | None = None,
|
|
925
|
+
_snapshot_id: str | None = None,
|
|
887
926
|
) -> Path:
|
|
888
|
-
"""Download one file with cache-first lookup and a shared budget for locks, probes, and retries.
|
|
927
|
+
"""Download one file with cache-first lookup and a shared budget for locks, probes, and retries.
|
|
928
|
+
|
|
929
|
+
*_snapshot_id* is supplied only by snapshot downloads. A standalone call
|
|
930
|
+
sends no snapshot identifier, so the Hub counts it per file.
|
|
931
|
+
"""
|
|
889
932
|
with _DownloadControl(
|
|
890
933
|
total_timeout=DOWNLOAD_TOTAL_TIMEOUT if self._total_timeout is None else self._total_timeout,
|
|
891
934
|
cancel_event=_cancel_event,
|
|
@@ -913,6 +956,7 @@ class DownloadManager:
|
|
|
913
956
|
user_agent,
|
|
914
957
|
progress_callbacks,
|
|
915
958
|
_control=control,
|
|
959
|
+
_snapshot_id=_snapshot_id,
|
|
916
960
|
)
|
|
917
961
|
|
|
918
962
|
def _download_file(
|
|
@@ -931,6 +975,7 @@ class DownloadManager:
|
|
|
931
975
|
progress_callbacks: list[type[ProgressCallback]] | None = None,
|
|
932
976
|
*,
|
|
933
977
|
_control: _DownloadControl,
|
|
978
|
+
_snapshot_id: str | None = None,
|
|
934
979
|
) -> Path:
|
|
935
980
|
"""Download a single file from a repository.
|
|
936
981
|
|
|
@@ -971,6 +1016,9 @@ class DownloadManager:
|
|
|
971
1016
|
progress_callbacks:
|
|
972
1017
|
List of :class:`ProgressCallback` *classes* (not instances).
|
|
973
1018
|
Each class is instantiated per-file with ``(filename, file_size)``.
|
|
1019
|
+
_snapshot_id:
|
|
1020
|
+
Identifier of the enclosing snapshot download, reused by every
|
|
1021
|
+
attempt including integrity retries. ``None`` for standalone downloads.
|
|
974
1022
|
|
|
975
1023
|
Returns
|
|
976
1024
|
-------
|
|
@@ -1049,6 +1097,7 @@ class DownloadManager:
|
|
|
1049
1097
|
prefer_default_route=prefer_default_route,
|
|
1050
1098
|
control=_control,
|
|
1051
1099
|
expected_sha256=expected_sha256,
|
|
1100
|
+
snapshot_id=_snapshot_id,
|
|
1052
1101
|
)
|
|
1053
1102
|
break
|
|
1054
1103
|
except FileIntegrityError as exc:
|
|
@@ -1134,9 +1183,16 @@ class DownloadManager:
|
|
|
1134
1183
|
user_agent: dict | str | None = None,
|
|
1135
1184
|
progress_callbacks: list[type[ProgressCallback]] | None = None,
|
|
1136
1185
|
file_list: list[dict] | None = None,
|
|
1186
|
+
_snapshot_id: str | None = None,
|
|
1137
1187
|
) -> Path:
|
|
1138
1188
|
"""Download an entire repository (snapshot download).
|
|
1139
1189
|
|
|
1190
|
+
Each call is one logical snapshot download: every file request it issues,
|
|
1191
|
+
including retries, resumed transfers and range parts, carries the same
|
|
1192
|
+
``snapshot-identifier`` for server-side dataset deduplication. A non-blank
|
|
1193
|
+
caller-supplied *_snapshot_id* is preserved; otherwise a fresh one is generated.
|
|
1194
|
+
Files that are already cached issue no requests.
|
|
1195
|
+
|
|
1140
1196
|
Parameters
|
|
1141
1197
|
----------
|
|
1142
1198
|
repo_id:
|
|
@@ -1268,6 +1324,8 @@ class DownloadManager:
|
|
|
1268
1324
|
logger.info("No files to download for %s@%s", repo_id, effective_revision)
|
|
1269
1325
|
return output_dir
|
|
1270
1326
|
|
|
1327
|
+
snapshot_id = _snapshot_id if _snapshot_id and _snapshot_id.strip() else _new_snapshot_id()
|
|
1328
|
+
logger.debug("Snapshot download %s of %s@%s", snapshot_id, repo_id, effective_revision)
|
|
1271
1329
|
logger.info("Downloading %d files from %s@%s", len(download_items), repo_id, effective_revision)
|
|
1272
1330
|
|
|
1273
1331
|
failures: dict[str, BaseException] = {}
|
|
@@ -1293,6 +1351,7 @@ class DownloadManager:
|
|
|
1293
1351
|
user_agent=user_agent,
|
|
1294
1352
|
progress_callbacks=progress_callbacks,
|
|
1295
1353
|
_cancel_event=cancel_event,
|
|
1354
|
+
_snapshot_id=snapshot_id,
|
|
1296
1355
|
)
|
|
1297
1356
|
futures[future] = fp
|
|
1298
1357
|
|
|
@@ -1785,6 +1844,7 @@ class DownloadManager:
|
|
|
1785
1844
|
prefer_default_route: bool = False,
|
|
1786
1845
|
control: _DownloadControl,
|
|
1787
1846
|
expected_sha256: str | None = None,
|
|
1847
|
+
snapshot_id: str | None = None,
|
|
1788
1848
|
) -> Path:
|
|
1789
1849
|
"""Download a file with HTTP Range resume support and retry.
|
|
1790
1850
|
|
|
@@ -1794,11 +1854,14 @@ class DownloadManager:
|
|
|
1794
1854
|
body whose size contradicts the listing raises
|
|
1795
1855
|
:class:`~.errors.FileSizeMismatchError` and leaves no partial file.
|
|
1796
1856
|
*prefer_default_route* skips intra-cloud and peer-region routing so a
|
|
1797
|
-
retry can avoid a replica that served bad content.
|
|
1857
|
+
retry can avoid a replica that served bad content. *snapshot_id* is
|
|
1858
|
+
carried by every attempt, range part and route probe of this file.
|
|
1798
1859
|
"""
|
|
1799
1860
|
use_parallel = file_size is not None and file_size > DOWNLOAD_PARALLEL_THRESHOLD and DOWNLOAD_PARALLELS > 1
|
|
1800
1861
|
|
|
1801
|
-
download_headers = self._build_download_headers(
|
|
1862
|
+
download_headers = self._build_download_headers(
|
|
1863
|
+
user_agent, accelerate=not prefer_default_route, snapshot_id=snapshot_id
|
|
1864
|
+
)
|
|
1802
1865
|
|
|
1803
1866
|
# Inter-region acceleration: first discover the file's storage route,
|
|
1804
1867
|
# then cache only a confirmed internal resolution for that exact route.
|
|
@@ -14,12 +14,15 @@ from pathlib import Path
|
|
|
14
14
|
from typing import TextIO
|
|
15
15
|
from urllib.parse import urlsplit, urlunsplit
|
|
16
16
|
|
|
17
|
+
from ._download import _new_snapshot_id
|
|
17
18
|
from .errors import InvalidParameter
|
|
18
19
|
from .types import DownloadFileResult, DownloadReport
|
|
19
20
|
from .utils.logger import get_logger
|
|
20
21
|
|
|
21
22
|
logger = get_logger("download")
|
|
22
23
|
|
|
24
|
+
_SNAPSHOT_ID_RE = re.compile(r"[0-9a-f]{32}")
|
|
25
|
+
|
|
23
26
|
|
|
24
27
|
def safe_error(error: BaseException) -> str:
|
|
25
28
|
"""Keep diagnostics without persisting credentials or presigned queries."""
|
|
@@ -36,10 +39,17 @@ def safe_error(error: BaseException) -> str:
|
|
|
36
39
|
class _DownloadState:
|
|
37
40
|
"""Sparse JSON recovery hints, never an authority for file completeness.
|
|
38
41
|
|
|
39
|
-
Persist exceptional files, failed pages,
|
|
40
|
-
Per-file results stay in an anonymous spool
|
|
41
|
-
no permanent JSONL or per-run summary files
|
|
42
|
-
do not rewrite the tracker; actual partial
|
|
42
|
+
Persist exceptional files, failed pages, the latest summary and the task's
|
|
43
|
+
snapshot identifier together. Per-file results stay in an anonymous spool
|
|
44
|
+
owned by the returned report; no permanent JSONL or per-run summary files
|
|
45
|
+
are created. Healthy transfers do not rewrite the tracker; actual partial
|
|
46
|
+
files suffice after a crash.
|
|
47
|
+
|
|
48
|
+
The snapshot identifier stays open while the task is unfinished, so a rerun
|
|
49
|
+
after a PARTIAL or CANCELLED run (or a crash) keeps counting as the same
|
|
50
|
+
snapshot download. A COMPLETE run closes it and the next run starts a new
|
|
51
|
+
task. It is written only alongside the scope header of a new tracker, an
|
|
52
|
+
exceptional record or the final summary, never as an extra write.
|
|
43
53
|
"""
|
|
44
54
|
|
|
45
55
|
def __init__(self, path: Path, identity: dict[str, str]) -> None:
|
|
@@ -55,15 +65,24 @@ class _DownloadState:
|
|
|
55
65
|
self._spool: TextIO | None = tempfile.TemporaryFile(mode="w+t", encoding="utf-8")
|
|
56
66
|
self._counts: dict[str, int] = {}
|
|
57
67
|
self._summary: dict | None = None
|
|
68
|
+
self._snapshot: dict | None = None
|
|
58
69
|
self.warnings: list[str] = []
|
|
59
70
|
try:
|
|
60
71
|
self._load()
|
|
72
|
+
if self._snapshot is None:
|
|
73
|
+
self._snapshot = {"id": _new_snapshot_id(), "open": True}
|
|
61
74
|
if not path.exists():
|
|
62
75
|
self._save()
|
|
63
76
|
except BaseException:
|
|
64
77
|
self.close()
|
|
65
78
|
raise
|
|
66
79
|
|
|
80
|
+
@property
|
|
81
|
+
def snapshot_id(self) -> str:
|
|
82
|
+
"""Identifier shared by every file request of this download task."""
|
|
83
|
+
assert self._snapshot is not None
|
|
84
|
+
return str(self._snapshot["id"])
|
|
85
|
+
|
|
67
86
|
def _warn(self, message: str) -> None:
|
|
68
87
|
if message not in self.warnings and len(self.warnings) < 10:
|
|
69
88
|
self.warnings.append(message)
|
|
@@ -80,6 +99,14 @@ class _DownloadState:
|
|
|
80
99
|
raise InvalidParameter(
|
|
81
100
|
"Download tracker belongs to a different endpoint/repository/revision/output directory"
|
|
82
101
|
)
|
|
102
|
+
snapshot = data.get("snapshot")
|
|
103
|
+
if (
|
|
104
|
+
isinstance(snapshot, dict)
|
|
105
|
+
and snapshot.get("open") is True
|
|
106
|
+
and isinstance(snapshot.get("id"), str)
|
|
107
|
+
and _SNAPSHOT_ID_RE.fullmatch(snapshot["id"])
|
|
108
|
+
):
|
|
109
|
+
self._snapshot = {"id": snapshot["id"], "open": True}
|
|
83
110
|
files, pages = data.get("files", {}), data.get("pages", {})
|
|
84
111
|
if not isinstance(files, dict) or not isinstance(pages, dict):
|
|
85
112
|
raise ValueError("Invalid recovery records")
|
|
@@ -121,6 +148,7 @@ class _DownloadState:
|
|
|
121
148
|
except (ValueError, UnicodeError, OSError):
|
|
122
149
|
self._exceptions.clear()
|
|
123
150
|
self._pages.clear()
|
|
151
|
+
self._snapshot = None
|
|
124
152
|
self._warn(
|
|
125
153
|
"Cannot load download recovery hints; continuing with actual-file validation and bounded retries"
|
|
126
154
|
)
|
|
@@ -144,6 +172,7 @@ class _DownloadState:
|
|
|
144
172
|
"files": {path: asdict(result) for path, result in self._exceptions.items()},
|
|
145
173
|
"pages": self._pages,
|
|
146
174
|
"report": self._summary,
|
|
175
|
+
"snapshot": self._snapshot,
|
|
147
176
|
},
|
|
148
177
|
stream,
|
|
149
178
|
ensure_ascii=False,
|
|
@@ -256,6 +285,8 @@ class _DownloadState:
|
|
|
256
285
|
report._attach_file_results(self._spool)
|
|
257
286
|
self._spool = None
|
|
258
287
|
self._summary = {**asdict(report), "run_id": run}
|
|
288
|
+
if self._snapshot is not None:
|
|
289
|
+
self._snapshot["open"] = report.status != "COMPLETE"
|
|
259
290
|
self._save()
|
|
260
291
|
report.state_warnings = list(self.warnings)
|
|
261
292
|
return report
|