Skip to content

Commit 31dde9c

Browse files
committed
fix(handler): move diagnostics into handler function for log capture
- diagnostics now run on every request instead of module import time - use print() instead of logger for better stdout capture - this ensures diagnostic output appears in runpod serverless logs
1 parent 9168350 commit 31dde9c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

handler.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,34 @@ def handler(job):
534534
Returns:
535535
dict: A dictionary containing either an error message or a success status with generated images.
536536
"""
537+
# ---------------------------------------------------------------------------
538+
# Diagnostic output for network volume debugging (runs on every request)
539+
# ---------------------------------------------------------------------------
540+
print("--- worker-comfyui: Network Volume Diagnostics ---")
541+
extra_model_paths_file = "/comfyui/extra_model_paths.yaml"
542+
if os.path.isfile(extra_model_paths_file):
543+
print(f"extra_model_paths.yaml: FOUND at {extra_model_paths_file}")
544+
with open(extra_model_paths_file, "r") as f:
545+
print(f"extra_model_paths.yaml content:\n{f.read()}")
546+
else:
547+
print(f"extra_model_paths.yaml: NOT FOUND at {extra_model_paths_file}")
548+
549+
runpod_volume = "/runpod-volume"
550+
if os.path.isdir(runpod_volume):
551+
print(f"Network volume: MOUNTED at {runpod_volume}")
552+
try:
553+
contents = os.listdir(runpod_volume)
554+
print(f"{runpod_volume} contents: {contents}")
555+
models_dir = os.path.join(runpod_volume, "models")
556+
if os.path.isdir(models_dir):
557+
models_contents = os.listdir(models_dir)
558+
print(f"{models_dir} contents: {models_contents}")
559+
except Exception as e:
560+
print(f"Error listing {runpod_volume}: {e}")
561+
else:
562+
print(f"Network volume: NOT MOUNTED at {runpod_volume}")
563+
print("--- End Diagnostics ---")
564+
537565
job_input = job["input"]
538566
job_id = job["id"]
539567

0 commit comments

Comments
 (0)