Add debug logging to cache lookup

This commit is contained in:
gilesb
2026-01-08 02:11:37 +00:00
parent 3e12596dbf
commit 01f6db0621
3 changed files with 70 additions and 0 deletions

View File

@@ -280,6 +280,42 @@ async def root():
return HOME_HTML
@app.get("/debug/cache/{content_hash}")
async def debug_cache(content_hash: str):
"""Debug endpoint to check cache status for a content hash."""
import os
result = {
"content_hash": content_hash,
"cache_dir": str(cache_manager.cache_dir),
"nodes_dir": str(cache_manager.cache.cache_dir),
"in_content_index": content_hash in cache_manager._content_index,
"node_id_from_index": cache_manager._content_index.get(content_hash),
}
# Check various locations
locations = {
"legacy_direct": cache_manager.cache_dir / content_hash,
"nodes_dir": cache_manager.cache.cache_dir / content_hash,
}
for name, path in locations.items():
result[f"{name}_path"] = str(path)
result[f"{name}_exists"] = path.exists()
if path.exists() and path.is_dir():
result[f"{name}_contents"] = [f.name for f in path.iterdir()]
# Check if artdag cache has it
result["artdag_cache_get"] = str(cache_manager.cache.get(content_hash))
# Check via cache_manager
found_path = cache_manager.get_by_content_hash(content_hash)
result["cache_manager_path"] = str(found_path) if found_path else None
result["has_content"] = cache_manager.has_content(content_hash)
return result
@app.post("/runs", response_model=RunStatus)
async def create_run(request: RunRequest, username: str = Depends(get_required_user)):
"""Start a new rendering run. Requires authentication."""