[Bugfix][CI] Fix the flaky sharded-sampling tests, and the engine teardown need (#58342)

Signed-off-by: Stefan Koncarevic <Stefan.Koncarevic@amd.com>
Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
Co-authored-by: Andreas Karatzas <Andreas.Karatzas@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
stefankoncarevic
2026-09-24 02:05:11 -07:00
committed by GitHub
co-authored by Andreas Karatzas Andreas Karatzas
parent 23110a0c9e
commit c0c35ddd8e
3 changed files with 132 additions and 37 deletions
+7 -1
View File
@@ -366,6 +366,11 @@ class InprocClient(EngineCoreClient):
log_stats,
executor_fail_callback=executor_fail_callback,
)
# Release the executor's workers when the client is collected, as
# MPClient does; they hold GPU memory for the life of the process
# otherwise. The callback must not reference self, or self would stay
# reachable and the finalizer would never run.
self._finalizer = weakref.finalize(self, self.engine_core.shutdown)
def get_output(self) -> EngineCoreOutputs:
outputs, model_executed = self.engine_core.step_fn()
@@ -384,7 +389,8 @@ class InprocClient(EngineCoreClient):
self.engine_core.abort_requests(request_ids)
def shutdown(self, timeout: float | None = None) -> None:
self.engine_core.shutdown()
if self._finalizer.detach() is not None:
self.engine_core.shutdown()
def profile(self, is_start: bool = True, profile_prefix: str | None = None) -> None:
self.engine_core.profile(is_start, profile_prefix)