Commit 2d1acde
nas: 4 new CLI commands + --group on model list (G4) (#474)
* nas: 4 new CLI commands + --group on model list (G4)
Wraps the new public API routes from the agentic-surface-area onsite plan:
roboflow train cancel <project>/<version> [--continue-if-no-refund]
roboflow train stop <project>/<version>
roboflow train results <project>/<version>
roboflow model star <model-id> [--unstar]
Plus extends `roboflow model list -p <project>` with `-g/--group <modelGroup>`,
the canonical "list NAS models per run" path. When --group is set, the list
command hits the public /models endpoint (full enriched projection: hardware,
latency, map5095, paretoOptimalFor, recommended ★) instead of walking versions
via the SDK.
Adapter additions in roboflow/adapters/rfapi.py:
cancel_version_training, stop_version_training, get_training_results,
list_project_models (with optional group), get_model_by_url,
favorite_nas_model
Backend companions:
- roboflow#11603 (G1, validator)
- roboflow#11605 (G6, projection + ?group=)
- roboflow#11610 (G2, public train cancel/stop + favorite)
- roboflow#11612 (G3, training results)
Tests: +13 cases across test_train_handler.py and test_model_handler.py
covering register, success paths, 409 + MODEL_NOT_NAS hint surfacing,
unstar flow, and the --group endpoint switch. All 298 CLI tests pass
locally; ruff check + ruff format clean.
CLI-COMMANDS.md updated with two new sections (train lifecycle + NAS
list/star/deploy).
E2E: driven against staging (api.roboflow.one) on
peter-robicheaux/beer-can-hackathon:
- `train results .../410` returned full NAS bundle (52 models,
recommendedByHardware, modelGroup)
- `model list -p ... -g <modelGroup>` rendered 53-row leaderboard
table with HARDWARE / LATENCY / MAP50 / MAP5095 / REC columns
- `model star 14CwSGmGetWh6rB0EnjL` → success, favorites reflected
- `model star --unstar` flips state
- `train cancel .../318` (finished version) → 409 surfaces hint
"Cancel only applies to in-flight runs."
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* nas: 'model star' takes URL slug instead of Firestore doc id
The public favorite endpoint now accepts the model URL slug
(roboflow#11646), so the CLI can drop the Firestore-doc-id wart.
Changes:
- star_model argument is now `model_url`, accepting either the bare
slug (when -w is set / a default workspace exists) or the
workspace-prefixed form `<ws>/<slug>` — same shape as `model get`.
- rfapi.favorite_nas_model parameter renamed `model_id` → `model_url`
with urllib.parse.quote() for safety, since the slug is now what
appears in the path.
- Hints updated to point at models[].modelUrl instead of modelId, and
the workspace fallback hint mentions the prefix form.
Tests: +2 cases for the new parsing (workspace-prefixed URL vs bare
slug + -w fallback). 22/22 model handler tests pass; 36/36 across
model + train.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: train_results fixture uses URL slugs, not doc ids
Mirrors the backend cleanup in roboflow#11646. The training-results
fixture now uses the public shape (trainingId is workspace/project/
version, models[].modelUrl, recommendedByHardware values are URL
slugs).
No behavior change in the CLI handler — it passes the response through.
* nas: 'model star' arg + favorite_nas_model param: model_url → model_id
Mirrors the wire rename in roboflow#11646. The public API field for
the opaque model identifier is now `modelId` (the value is still the
URL slug; that's an implementation detail callers shouldn't have to
reason about).
Changes:
- `roboflow model star` argument: `model_url` → `model_id`. Help text
and error hints updated to point at `models[].modelId`.
- `rfapi.favorite_nas_model(model_url=...)` → `favorite_nas_model(
model_id=...)`. Internal local var becomes `public_model_id` to
keep the call-site readable.
- Test fixtures: `model_url` arg → `model_id`, `models[].modelUrl` →
`models[].modelId`. 36/36 tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(pre_commit): 🎨 auto format pre-commit hooks
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent e37327c commit 2d1acde
6 files changed
Lines changed: 733 additions & 2 deletions
File tree
- roboflow
- adapters
- cli/handlers
- tests/cli
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
50 | 94 | | |
51 | 95 | | |
52 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
99 | 192 | | |
100 | 193 | | |
101 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
18 | 29 | | |
19 | | - | |
20 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
21 | 35 | | |
22 | 36 | | |
23 | 37 | | |
| |||
31 | 45 | | |
32 | 46 | | |
33 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
34 | 72 | | |
35 | 73 | | |
36 | 74 | | |
| |||
86 | 124 | | |
87 | 125 | | |
88 | 126 | | |
| 127 | + | |
89 | 128 | | |
90 | 129 | | |
91 | 130 | | |
| 131 | + | |
92 | 132 | | |
93 | 133 | | |
94 | 134 | | |
95 | 135 | | |
96 | 136 | | |
97 | 137 | | |
98 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
99 | 185 | | |
100 | 186 | | |
101 | 187 | | |
| |||
130 | 216 | | |
131 | 217 | | |
132 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
133 | 281 | | |
134 | 282 | | |
135 | 283 | | |
| |||
0 commit comments