[PR #2548] [CLOSED] calibrate: an engine that stops while a later step measures it drops that candidate, not the run (#2313) #4113

Closed
opened 2026-11-07 15:33:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2548
Author: @qiuzan2001
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: chief-serve/calibrate-engine-died


📝 Commits (1)

  • 4139087 calibrate: an engine that stops while a later step measures it drops that candidate, not the run (#2313)

📊 Changes

2 files changed (+51 additions, -0 deletions)

View changed files

📝 tools/calibrate.py (+16 -0)
📝 tools/test_calibrate.py (+35 -0)

📄 Description

Fixes the calibrate side of #2313 (who sent the engine its SIGTERM is not known and not touched here).

What it changes. In tools/calibrate.py a later step's engine that fails to start already costs only that
candidate (#1337, restart()). An engine that started and then stopped while it was measured (EngineDied; in
#2313 exit code -15 during the 4-worker step) still ended the whole calibration: setup printed "the tuning did not
finish" and the PCIe share, draft floor and worker counts measured before were lost. Now, in the worker step and the
expert-tier step, a measurement that raises is said (measuring 4 workers failed: the engine stopped unexpectedly (exit code -15) - this candidate is dropped, the earlier results are kept), noted in report["failed_runs"], and
that candidate is dropped; the step's choice is made from the candidates that finished, and when the default's own
run failed the default stays.

close() also closes the pipe to an engine that has gone after the failed QUIT write, so Python no longer prints
Exception ignored while finalizing file ... BrokenPipeError later (the traceback in the issue).

What it leaves alone. Every run where no engine stops: the same measurements, choices and output. An engine that
stops during the first sweep (steps 1-3, one engine start) still ends the run, as before: nothing is measured yet.
setup.py's calibrate_config is unchanged (it reads only settings and tok_s). This PR and #2544 (also
tools/calibrate.py, #2465) touch different lines of measure().

How it was checked.

  • tools/test_calibrate.py:
    • test_an_engine_that_stops_while_measured_only_drops_that_candidate_2313: a stand-in engine raises EngineDied
      in the 4-worker run and in the 80-swap tier run; the PCIe share and the 3-worker win survive, both failures are
      in failed_runs. On main the run ends with EngineDied.
    • test_close_an_engine_that_has_gone_2313: close() on a real child process that has exited leaves stdin
      closed and nothing for sys.unraisablehook. On main the pipe stays open.
  • python3 tools/test_calibrate.py: 19 tests OK.
  • Python 3.14, Ubuntu (Linux 7.0); no GPU needed (stand-in engines). Not run on the reporter's HIP eGPU, nor on Windows.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/2548 **Author:** [@qiuzan2001](https://github.com/qiuzan2001) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `chief-serve/calibrate-engine-died` --- ### 📝 Commits (1) - [`4139087`](https://github.com/Niko1221/Strata/commit/41390876f4609c16c48faab626405b5cbaf4ae74) calibrate: an engine that stops while a later step measures it drops that candidate, not the run (#2313) ### 📊 Changes **2 files changed** (+51 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tools/calibrate.py` (+16 -0) 📝 `tools/test_calibrate.py` (+35 -0) </details> ### 📄 Description Fixes the calibrate side of #2313 (who sent the engine its SIGTERM is not known and not touched here). **What it changes.** In `tools/calibrate.py` a later step's engine that fails to *start* already costs only that candidate (#1337, `restart()`). An engine that started and then stopped *while it was measured* (`EngineDied`; in #2313 exit code -15 during the 4-worker step) still ended the whole calibration: setup printed "the tuning did not finish" and the PCIe share, draft floor and worker counts measured before were lost. Now, in the worker step and the expert-tier step, a measurement that raises is said (`measuring 4 workers failed: the engine stopped unexpectedly (exit code -15) - this candidate is dropped, the earlier results are kept`), noted in `report["failed_runs"]`, and that candidate is dropped; the step's choice is made from the candidates that finished, and when the default's own run failed the default stays. `close()` also closes the pipe to an engine that has gone after the failed `QUIT` write, so Python no longer prints `Exception ignored while finalizing file ... BrokenPipeError` later (the traceback in the issue). **What it leaves alone.** Every run where no engine stops: the same measurements, choices and output. An engine that stops during the first sweep (steps 1-3, one engine start) still ends the run, as before: nothing is measured yet. `setup.py`'s `calibrate_config` is unchanged (it reads only `settings` and `tok_s`). This PR and #2544 (also `tools/calibrate.py`, #2465) touch different lines of `measure()`. **How it was checked.** - `tools/test_calibrate.py`: - `test_an_engine_that_stops_while_measured_only_drops_that_candidate_2313`: a stand-in engine raises `EngineDied` in the 4-worker run and in the 80-swap tier run; the PCIe share and the 3-worker win survive, both failures are in `failed_runs`. On `main` the run ends with `EngineDied`. - `test_close_an_engine_that_has_gone_2313`: `close()` on a real child process that has exited leaves stdin closed and nothing for `sys.unraisablehook`. On `main` the pipe stays open. - `python3 tools/test_calibrate.py`: 19 tests OK. - Python 3.14, Ubuntu (Linux 7.0); no GPU needed (stand-in engines). Not run on the reporter's HIP eGPU, nor on Windows. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:33:19 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#4113
No description provided.