mirror of
https://github.com/turnstonelabs/turnstone.git
synced 2026-08-12 23:12:23 -06:00
fix(eval): close the parallel lane's per-item client
The subprocess worker built a fresh client per work item and never closed it. Pool workers are reused across items, so each one accumulated a live transport per item for the life of the sweep.
This commit is contained in:
@@ -822,6 +822,21 @@ def _run_and_score_subprocess(params: dict[str, Any]) -> dict[str, Any]:
|
||||
case: dict[str, Any] = params["case"]
|
||||
run_tokens = 0
|
||||
|
||||
try:
|
||||
return _run_and_score_with(client, params, case, run_tokens)
|
||||
finally:
|
||||
# Pool workers are reused across work items, so an unclosed
|
||||
# client accumulates one live transport per item inside the
|
||||
# worker process for the life of the sweep.
|
||||
with contextlib.suppress(Exception):
|
||||
client.close()
|
||||
|
||||
|
||||
def _run_and_score_with(
|
||||
client: Any, params: dict[str, Any], case: dict[str, Any], run_tokens: int
|
||||
) -> dict[str, Any]:
|
||||
"""The body of :func:`_run_and_score_subprocess`, client lifetime
|
||||
owned by the caller."""
|
||||
try:
|
||||
run_result = _run_single_test(
|
||||
client=client,
|
||||
|
||||
Reference in New Issue
Block a user