Repository navigation
Commit 04463eb
committed
fix: drop late reports into an already-finished trial (#996 follow-up)
thinkall's fourth CHANGES_REQUESTED review, point 2: a _RunContext
captured for a trial stays usable after that trial finishes. A worker
thread or executor task that captured get_run_context() and reports
late, after the trial is already TERMINATED, still wrote through:
process_trial_result() overwrote the trial's final metric_analysis and
last_result with the stale value, and report()'s own trailing
`if trial.is_finished(): raise StopIteration` (the normal
scheduler-stop signal for the current report) then raised into the
late caller too, which has no reason to expect it the way a
trainable's own control-flow loop does.
report() now checks trial.is_finished() before processing and drops
the late report instead. New regression test captures a context,
lets the trial finish, then reports through the stale context: fails
with an uncaught StopIteration on the prior commit, passes now, and
asserts last_result/metric_analysis are byte-for-byte unchanged by
the late write.
Point 1 (a persistent callback/queue worker started before tune.run()
never gets context for later items) is not fixed here: replied on the
PR with why an automatic fallback is not safe to ship.1 parent 16773f5 commit 04463eb
2 files changed
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
577 | 586 | | |
578 | 587 | | |
579 | 588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
572 | 614 | | |
573 | 615 | | |
574 | 616 | | |
| |||
0 commit comments