The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Disable the output assets scanning. (#16926)
comfyanonymous3a52aae7ca10
diff --git a/app/assets/api/routes.py b/app/assets/api/routes.pyindex 2d81a5625..9f13c99f4 100644--- a/app/assets/api/routes.py+++ b/app/assets/api/routes.py@@ -1036,7 +1036,7 @@ _PRUNE_POLL_SECONDS = 0.25@ROUTES.post("/api/assets/seed")@_require_assets_feature_enabledasync def seed_assets(request: web.Request) -> web.Response:- """Trigger asset seeding for specified roots (models, input, output).+ """Trigger asset seeding for specified roots (models, input).Query params:wait: If "true", block until scan completes (synchronous behavior for tests)@@ -1048,11 +1048,11 @@ async def seed_assets(request: web.Request) -> web.Response:"""try:payload = await request.json()- roots = payload.get("roots", ["models", "input", "output"])+ roots = payload.get("roots", ["models", "input"])except Exception:- roots = ["models", "input", "output"]+ roots = ["models", "input"]- valid_roots = tuple(r for r in roots if r in ("models", "input", "output"))+ valid_roots = tuple(r for r in roots if r in ("models", "input"))if not valid_roots:return _build_error_response(400, "INVALID_BODY", "No valid roots specified")diff --git a/app/assets/lifecycle.py b/app/assets/lifecycle.pyindex 02f86e7ab..753b57725 100644--- a/app/assets/lifecycle.py+++ b/app/assets/lifecycle.py@@ -101,12 +101,12 @@ def start_asset_seeder() -> bool:from app.assets.seeder import asset_seederstarted = asset_seeder.start(- roots=("models", "input", "output"),+ roots=("models", "input"),prune_first=True,compute_hashes=args.enable_asset_hashing,)if started:- logging.info("Background asset scan initiated for models, input, output")+ logging.info("Background asset scan initiated for models, input")return starteddiff --git a/app/assets/manager.py b/app/assets/manager.pyindex ed23ef690..7cef190af 100644--- a/app/assets/manager.py+++ b/app/assets/manager.py@@ -21,7 +21,7 @@ from comfy.cli_args import args# does not touch these names.if dependencies_available():from app.assets.api.routes import register_assets_routes- from app.assets.seeder import ScanPhase, asset_seeder+ from app.assets.seeder import asset_seederfrom app.assets.services.ingest import (register_cached_output as ingest_register_cached_output,register_executed_output as ingest_register_executed_output,@@ -165,19 +165,13 @@ class AssetsEnabled:register_assets_routes(app, user_manager)def ensure_scan_started(self) -> None:- asset_seeder.start(roots=("models", "input", "output"))+ asset_seeder.start(roots=("models", "input"))def pause_background_scan(self) -> None:asset_seeder.pause()def queue_output_scan(self) -> None:- if not asset_seeder.is_disabled():- # FULL, not ENRICH: only a walk finds outputs a node never declared. Do not downgrade without re-weighing the cost.- asset_seeder.enqueue_scan(- roots=("output",),- phase=ScanPhase.FULL,- compute_hashes=self._args.enable_asset_hashing,- )+ return Nonedef resume_background_scan(self) -> None:asset_seeder.resume()diff --git a/app/assets/seeder.py b/app/assets/seeder.pyindex 84dbced3f..a01ee8fa4 100644--- a/app/assets/seeder.py+++ b/app/assets/seeder.py@@ -219,7 +219,7 @@ class _AssetSeeder:def start(self,- roots: tuple[RootType, ...] = ("models", "input", "output"),+ roots: tuple[RootType, ...] = ("models", "input"),phase: ScanPhase = ScanPhase.FULL,progress_callback: ProgressCallback | None = None,prune_first: bool = False,@@ -271,7 +271,7 @@ class _AssetSeeder:def start_fast(self,- roots: tuple[RootType, ...] = ("models", "input", "output"),+ roots: tuple[RootType, ...] = ("models", "input"),progress_callback: ProgressCallback | None = None,prune_first: bool = False,) -> bool:diff --git a/tests-unit/assets_test/services/test_batched_marking.py b/tests-unit/assets_test/services/test_batched_marking.pyindex 7f77c4168..6590fe4cf 100644--- a/tests-unit/assets_test/services/test_batched_marking.py+++ b/tests-unit/assets_test/services/test_batched_marking.py@@ -556,7 +556,7 @@ async def test_a_seed_request_during_an_api_prune_waits_for_it_then_starts(monkeawait pruneassert response.status == 202- assert started == [("models", "input", "output")]+ assert started == [("models", "input")]@pytest.mark.asynciodiff --git a/tests-unit/assets_test/services/test_manager_isolated.py b/tests-unit/assets_test/services/test_manager_isolated.pyindex e195c1184..2af1cb9b0 100644--- a/tests-unit/assets_test/services/test_manager_isolated.py+++ b/tests-unit/assets_test/services/test_manager_isolated.py@@ -89,7 +89,7 @@ def output_seeder(monkeypatch: pytest.MonkeyPatch) -> Iterator[_OutputSeeder]:_ = seeder.shutdown()-def test_queue_output_scan_registers_undeclared_output(+def test_queue_output_scan_does_not_register_undeclared_output(enabled_manager: AssetsEnabled,asset_roots: tuple[Path, Path, Path],threaded_create_session: Callable[[], AbstractContextManager[Session]],@@ -110,8 +110,7 @@ def test_queue_output_scan_registers_undeclared_output(.where(AssetContent.path == str(output_path.resolve()))))- assert rows[0].job_id is None- assert len(rows) == 1+ assert rows == []def test_queue_output_scan_does_not_duplicate_declared_output(@@ -150,11 +149,8 @@ def test_queue_output_scan_does_not_duplicate_declared_output())assert rows[0].job_id == "declared-job"- assert undeclared_rows[0].job_id is Noneassert len(rows) == 1- assert len(undeclared_rows) == 1, (- "the undeclared sibling proves the walk ran, so the declared row's count of 1 is a real skip rather than a silently-failed scan"- )+ assert undeclared_rows == []def test_executed_and_cached_outputs_share_unhashed_content(@@ -258,7 +254,7 @@ def test_ensure_scan_started_starts_the_lazy_object_info_scan(enabled_manager.ensure_scan_started()- seeder_start.assert_called_once_with(roots=("models", "input", "output"))+ seeder_start.assert_called_once_with(roots=("models", "input"))def test_shutdown_runs_lifecycle_cleanup_when_seeder_shutdown_times_out(diff --git a/tests-unit/assets_test/test_crud.py b/tests-unit/assets_test/test_crud.pyindex c3e6cfbe0..f34cb1d77 100644--- a/tests-unit/assets_test/test_crud.py+++ b/tests-unit/assets_test/test_crud.py@@ -8,14 +8,14 @@ def test_missing_content_remains_in_list_after_rm_with_missing_tag(http, api_base, asset_factory, comfy_tmp_base_dir, make_asset_bytes):record = asset_factory(- "missing.png", ["output", "unit-tests"], {}, make_asset_bytes("missing")+ "missing.png", ["input", "unit-tests"], {}, make_asset_bytes("missing"))- next((comfy_tmp_base_dir / "output").glob("*.png")).unlink()+ next((comfy_tmp_base_dir / "input").glob("*.png")).unlink()response = Nonefor _attempt in range(5):response = http.post(- f"{api_base}/api/assets/seed?wait=true", json={"roots": ["output"]}+ f"{api_base}/api/assets/seed?wait=true", json={"roots": ["input"]})if response.status_code != 409:breakdiff --git a/tests/execution/test_execution.py b/tests/execution/test_execution.pyindex 0709c5449..d55df4d19 100644--- a/tests/execution/test_execution.py+++ b/tests/execution/test_execution.py@@ -21,8 +21,6 @@ from app.assets.services.file_utils import list_files_recursivelyASSET_HEALTH_TIMEOUT_SECONDS = 120-ASSET_SEED_RETRY_ATTEMPTS = 10-ASSET_SEED_RETRY_DELAY_SECONDS = 3ASSET_STATUS_POLL_DELAY_SECONDS = 1ASSET_CAPTURE_TAIL_LINES = 80@@ -53,16 +51,14 @@ ASSET_FATAL_LOG_PREFIXES = ()-def _asset_json_request(url, deadline, data=None):+def _asset_json_request(url, deadline):remaining = deadline - time.monotonic()if remaining <= 0:raise AssertionError(f"Asset health check failure (i): deadline/transport failure before requesting {url}")- request = urllib.request.Request(url, data=data)- if data is not None:- request.add_header("Content-Type", "application/json")+ request = urllib.request.Request(url)try:with urllib.request.urlopen(request, timeout=max(0.01, remaining)) as response:@@ -92,64 +88,6 @@ def _asset_json_request(url, deadline, data=None):return status, payload-def _seed_output_assets(base_url, deadline):- request_data = json.dumps({"roots": ["output"]}).encode("utf-8")- last_conflict_payload = None- for attempt in range(1, ASSET_SEED_RETRY_ATTEMPTS + 1):- if last_conflict_payload is not None and deadline - time.monotonic() <= 0:- raise AssertionError(- "Asset health check failure (ii): 409-retries-exhausted before the deadline; "- f"last payload={last_conflict_payload!r}"- )-- url = f"{base_url}/api/assets/seed?wait=true"- status, payload = _asset_json_request(url, deadline, request_data)- if status == 409:- if payload.get("status") != "already_running":- raise AssertionError(- "Asset health check failure (iv): malformed JSON/schema "- f"from {url}: status={status}, payload={payload!r}"- )- last_conflict_payload = payload- if attempt == ASSET_SEED_RETRY_ATTEMPTS:- raise AssertionError(- "Asset health check failure (ii): 409-retries-exhausted after "- f"{attempt} attempts; last payload={payload!r}"- )- remaining = deadline - time.monotonic()- if remaining <= 0:- raise AssertionError(- "Asset health check failure (ii): 409-retries-exhausted before the deadline; "- f"last payload={payload!r}"- )- time.sleep(min(ASSET_SEED_RETRY_DELAY_SECONDS, remaining))- continue- if status != 200:- raise AssertionError(- "Asset health check failure (iv): unexpected-HTTP-status "- f"from {url}: status={status}, payload={payload!r}"- )-- progress = payload.get("progress")- errors = payload.get("errors")- progress_fields = ("scanned", "total", "created", "skipped")- if (- payload.get("status") != "completed"- or not isinstance(progress, dict)- or any(type(progress.get(field)) is not int for field in progress_fields)- or not isinstance(errors, list)- ):- raise AssertionError(- "Asset health check failure (iv): malformed JSON/schema "- f"from {url}: status={status}, payload={payload!r}"- )- if errors:- raise AssertionError(- f"Asset health check failure (iii): scan-completed-with-errors: errors={errors!r}"- )- return--def _wait_for_stable_asset_idle(base_url, deadline):stable_reads = 0last_payload = None@@ -280,14 +218,13 @@ def _assert_no_fatal_asset_logs(capture_path):)-def _assert_assets_healthy(listen, port, output_dir, capture_path):+def _assert_assets_healthy(listen, port, output_dir, capture_path, initial_output_paths):deadline = time.monotonic() + ASSET_HEALTH_TIMEOUT_SECONDSbase_url = f"http://{listen}:{port}"- _seed_output_assets(base_url, deadline)_wait_for_stable_asset_idle(base_url, deadline)api_paths = _fetch_output_asset_paths(base_url, deadline)- disk_paths = _list_output_files_on_disk(output_dir)+ disk_paths = _list_output_files_on_disk(output_dir) - initial_output_pathsif not api_paths or not disk_paths:raise AssertionError("Asset health check reconcile failure: expected non-empty sets: "@@ -502,6 +439,7 @@ class TestExecution:assets_tmp_dir = tmp_path_factory.mktemp("execution-assets")database_path = assets_tmp_dir / "assets.db"capture_path = assets_tmp_dir / "server.log"+ initial_output_paths = _list_output_files_on_disk(args_pytest["output_dir"])pargs += ["--database-url", f"sqlite:///{database_path}"]print("Running server with args:", pargs) # noqa: T201if assets_enabled:@@ -529,6 +467,7 @@ class TestExecution:args_pytest["port"],args_pytest["output_dir"],capture_path,+ initial_output_paths,)except AssertionError as error:health_failure = error