Enhance backend management and performance tuning

- Introduced remounting logic for data directories to ensure correct bindings before restarting services, improving reliability during performance tuning.
- Added functions to sanitize and ensure absolute paths for backend scripts, preventing issues with relative paths in bind mounts.
- Enhanced the `patch_backends_extra_args` function to clean up corrupted entries and ensure proper configuration of backend parameters.
- Updated tests to validate the new sanitization and path handling functionalities, ensuring robustness in backend management.
This commit is contained in:
Leonid Pershin
2026-08-21 11:44:25 +03:00
parent fc60fef279
commit 021feaa839
4 changed files with 174 additions and 33 deletions
+20
View File
@@ -176,3 +176,23 @@ def test_sanitize_backends_fds_corruption(tmp_path, monkeypatch):
monkeypatch.setattr(mod, "BACKENDS", backends)
assert mod.sanitize_backends_fds() is True
assert backends.read_text(encoding="utf-8") == "ExtraArgs: --use-sage-attention\n"
def test_ensure_absolute_start_script(tmp_path, monkeypatch):
mod = _load()
data = tmp_path
main_py = data / "dlbackend" / "ComfyUI" / "main.py"
main_py.parent.mkdir(parents=True)
main_py.write_text("# comfy\n", encoding="utf-8")
backends = data / "Data" / "Backends.fds"
backends.parent.mkdir(parents=True)
backends.write_text(
"0:\n\ttype: comfyui_selfstart\n\tStartScript: dlbackend/ComfyUI/main.py\n",
encoding="utf-8",
)
monkeypatch.setattr(mod, "DATA", data)
monkeypatch.setattr(mod, "BACKENDS", backends)
assert mod.ensure_absolute_start_script() is True
text = backends.read_text(encoding="utf-8")
assert str(main_py.resolve()) in text
assert mod.ensure_absolute_start_script() is False