Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Failed uploads are reported as success: Version.deploy() / Workspace.deploy_model() don't raise, and roboflow model upload / roboflow image upload <dir> exit 0

未關閉
#545 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

  • #554 來自 @tonylampada —— 已關閉,未合併

評估

難度
4/5
預估耗時
3-5 天
新手友好度
55/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
api, cli

研究方向

Start with Version._upload_zip() and Workspace._upload_zip() for swallowed upload failures, then trace _upload_model in roboflow/cli/handlers/model.py and _handle_upload_directory in roboflow/cli/handlers/image.py. Read the related issue #497 and inspect tests for model and image uploads before deciding how to represent partial failures. Done means failed uploads propagate as errors and the CLI exits non-zero; add tests for both paths.

由索引模型根據 Issue 內容生成。

描述

Several upload paths catch errors, print them and continue, so scripts and the CLI cannot detect a failed upload (roboflow 1.7.0, also current main).

  1. Version._upload_zip() and Workspace._upload_zip() wrap both the request for the signed upload URL and the PUT in try/except Exception: print(...). Version.deploy() and Workspace.deploy_model() therefore return normally when the upload failed, and roboflow model upload (_upload_model in roboflow/cli/handlers/model.py) prints {"status": "uploaded"} and exits 0. The 429 branch raises a RuntimeError inside the same try, so it is swallowed too; since a version can own several models (#497), its message may also be outdated.
  2. Workspace.upload_dataset() (per-image flow) prints [ERR] <path> (...) for each failed image and returns None. roboflow image upload <dir> (_handle_upload_directory in roboflow/cli/handlers/image.py) then reports {"status": "imported", "count": N}, where N is the number of image files on disk, and exits 0, even if every upload failed. In the zip flow, a final status failed is passed through as "status": "failed", also with exit code 0.

Reproducer for 1, run from a checkout (offline, mocked HTTP):

from types import SimpleNamespace
from unittest.mock import patch
import responses
from tests.helpers import get_version

bundle = SimpleNamespace(model_type="yolov8n", archive_path=SimpleNamespace(name="roboflow_deploy.zip"))
with responses.RequestsMock() as rsps, patch(
    "roboflow.core.version.package_custom_weights_interactive", return_value=bundle
):
    rsps.add(responses.GET, "https://api.roboflow.com/Test Workspace Name/Test Project Name/1/uploadModel", status=500)
    print(get_version().deploy("yolov8n", "/tmp/weights", "weights/best.pt"))  # prints the error, then None

With the same mock and roboflow.Roboflow patched to return that version, roboflow --json model upload -p proj -v 1 -t yolov8n -m <dir> exits 0, and stdout is the printed error followed by {"status": "uploaded"}. For 2: with Project.upload_image raising ImageUploadError for every image, roboflow --json image upload <dir with 3 images> -p proj exits 0 and prints three [ERR] lines followed by {"status": "imported", "count": 3}.

Suggested behavior: raise RoboflowError from both _upload_zip methods (keeping the printed hints as the message) and let the CLI report it through output_error. For upload_dataset, return a summary (uploaded, duplicates, failed with reasons) and let the CLI exit non-zero when anything failed; treat a zip status failed as an error.

I'm happy to send a PR with tests for part 1. Part 2 changes a return value, so I'd like to hear your preference first. Related: #528 (annotation retries), #302.

cc @leeclemnet @digaobarbosa

主要語言
Python
星號
634
分支
144
平均合併
1 天 19 小時
30 天內合併 PR
18

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

roboflow/roboflow-python 的其他 Issue

查看 roboflow/roboflow-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。