Commit 7a4a691
job run: add --no-follow and fix behavior when websocket closes early (#1577)
* job run: add --no-follow and fix behavior when websocket closes early
Add --no-follow so CI can wait for job completion without streaming logs
to the console. When --no-follow is set we still consume the log stream
and only skip printing log lines and log blobs.
When the log stream websocket closes before a final status we now fetch
job status via REST and only show dataset versions if the job actually
finished. Otherwise we print "Lost connection" and exit 1. Also fix
the status check to use JobStatus.finished() and break on unknown
status to avoid an infinite loop.
* Update docs/commands/job/run.md
Co-authored-by: Vladimir Rudnykh <dreadatour@gmail.com>
* Skip ping messages
* Add no follow params to studio client
* Pass verbose flag through to job log streaming
Switch create_job call in process_jobs_args to use keyword arguments
for clarity and add the missing verbose parameter.
show_logs_from_client now accepts a verbose flag and prints diagnostic
messages when the job finishes, retries are exhausted, or an unknown
status is encountered. This makes it easier to debug log streaming
issues without needing to attach a debugger.
Amp-Thread-ID: https://ampcode.com/threads/T-019c3357-1a5b-76bb-8ea5-9f3baf69cc99
Co-authored-by: Amp <amp@ampcode.com>
* Fix tests
* Increase coverage
* studio: fix job run tests and switch verbose to logging
- Fix test_studio_run_non_zero_exit_code and websocket disconnect tests:
patch StudioClient.tail_job_logs where it is used (datachain.studio)
so the mock is applied. Add no_follow to mock signature to match real
API. Mock GET jobs with a regex so requests with query params match.
- In studio.py, drop the verbose flag from create_job and
show_logs_from_client; use logger.debug() for debug messages instead.
- Adjust test_studio_run_invalid_job_status to assert on caplog when
checking debug messages. Add tests for verbose (caplog), log blobs,
_get_job_status edge cases, rest_status None, dataset versions error,
and TASK status.
- Add return type to _get_job_status and log on exception.
* Add clarify
* Fix test
* Update tests/test_cli_studio.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Vladimir Rudnykh <dreadatour@gmail.com>
Co-authored-by: Amp <amp@ampcode.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent f3a7bf0 commit 7a4a691
File tree
5 files changed
+588
-45
lines changed- docs/commands/job
- src/datachain
- cli/parser
- remote
- tests
5 files changed
+588
-45
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
158 | 165 | | |
159 | 166 | | |
160 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
301 | 303 | | |
302 | 304 | | |
303 | 305 | | |
| |||
312 | 314 | | |
313 | 315 | | |
314 | 316 | | |
| 317 | + | |
| 318 | + | |
315 | 319 | | |
316 | 320 | | |
317 | 321 | | |
| |||
321 | 325 | | |
322 | 326 | | |
323 | 327 | | |
324 | | - | |
| 328 | + | |
| 329 | + | |
325 | 330 | | |
326 | 331 | | |
327 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| |||
366 | 370 | | |
367 | 371 | | |
368 | 372 | | |
369 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
370 | 386 | | |
371 | 387 | | |
372 | 388 | | |
373 | 389 | | |
374 | 390 | | |
375 | 391 | | |
376 | | - | |
377 | | - | |
| 392 | + | |
| 393 | + | |
378 | 394 | | |
379 | 395 | | |
380 | 396 | | |
381 | 397 | | |
382 | 398 | | |
383 | | - | |
| 399 | + | |
384 | 400 | | |
385 | 401 | | |
386 | 402 | | |
| |||
390 | 406 | | |
391 | 407 | | |
392 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
393 | 416 | | |
394 | | - | |
395 | | - | |
396 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
397 | 422 | | |
398 | 423 | | |
399 | 424 | | |
400 | 425 | | |
401 | | - | |
| 426 | + | |
402 | 427 | | |
403 | 428 | | |
404 | 429 | | |
405 | 430 | | |
406 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
407 | 444 | | |
408 | 445 | | |
409 | 446 | | |
| |||
417 | 454 | | |
418 | 455 | | |
419 | 456 | | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
425 | 464 | | |
426 | 465 | | |
427 | 466 | | |
| |||
442 | 481 | | |
443 | 482 | | |
444 | 483 | | |
| 484 | + | |
445 | 485 | | |
446 | 486 | | |
447 | 487 | | |
| |||
532 | 572 | | |
533 | 573 | | |
534 | 574 | | |
535 | | - | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
536 | 582 | | |
537 | 583 | | |
538 | 584 | | |
| |||
0 commit comments