Fix render_effect to find uploads in new cache location

The legacy render_effect task was looking for inputs only at
CACHE_DIR/{hash}, but uploads now go through cache_manager which
stores them in CACHE_DIR/nodes/{node_id}/. Now uses
cache_manager.get_by_content_hash() which checks both locations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-08 01:47:23 +00:00
parent ff195a7ce5
commit 0e4f596401

View File

@@ -154,8 +154,7 @@ def render_effect(self, input_hash: str, effect_name: str, output_name: str) ->
Returns: Returns:
Provenance record with output hash Provenance record with output hash
""" """
# Cache directory (shared between server and worker) from cache_manager import get_cache_manager
CACHE_DIR = Path(os.environ.get("CACHE_DIR", str(Path.home() / ".artdag" / "cache")))
# Registry hashes (for effects/infra metadata only) # Registry hashes (for effects/infra metadata only)
REGISTRY = { REGISTRY = {
@@ -173,9 +172,10 @@ def render_effect(self, input_hash: str, effect_name: str, output_name: str) ->
} }
} }
# Input comes from cache by hash # Input comes from cache by hash (supports both legacy and new cache locations)
input_path = CACHE_DIR / input_hash cache_manager = get_cache_manager()
if not input_path.exists(): input_path = cache_manager.get_by_content_hash(input_hash)
if not input_path or not input_path.exists():
raise ValueError(f"Input not in cache: {input_hash}") raise ValueError(f"Input not in cache: {input_hash}")
output_dir = CACHE_DIR output_dir = CACHE_DIR