* Fix _kill_process AttributeError when _stats_logger is unset LlamaCppBackend._kill_process references self._stats_logger in its finally block, but __init__ only sets self._stats_logger = None partway through. If __init__ raises before that line, or the backend is built via __new__ (as the kill-path unit test does), teardown crashes with AttributeError instead of cleaning up the process. Guard the reference with getattr, matching the existing hasattr(self, '_chat_template_file') guard in the same finally block. Fixes test_kill_process_records_timestamp_on_actual_kill. * Also guard _stdout_thread in _kill_process teardown Review follow-up: the same finally block also reads self._stdout_thread, which is unset on a partially-built / __new__ backend. Guard it with getattr like _llama_log_fh below, and add a test that _kill_process tolerates a backend with those optional attrs unset. Trim the _stats_logger comment. --------- Co-authored-by: Michael Han <michaelhan2050@gmail.com> |
||
|---|---|---|
| .. | ||
| assets | ||
| auth | ||
| core | ||
| hub | ||
| loggers | ||
| models | ||
| plugins | ||
| requirements | ||
| routes | ||
| state | ||
| storage | ||
| tests | ||
| utils | ||
| __init__.py | ||
| _platform_compat.py | ||
| cloudflare_tunnel.py | ||
| colab.py | ||
| main.py | ||
| run.py | ||
| startup_banner.py | ||