Commit
·
d9cd722
1
Parent(s):
0424dcc
debug: add logging to diagnose DeepISLES path discovery
Browse files
src/stroke_deepisles_demo/inference/direct.py
CHANGED
|
@@ -75,17 +75,32 @@ def _ensure_deepisles_importable() -> str:
|
|
| 75 |
search_paths = _get_deepisles_search_paths()
|
| 76 |
|
| 77 |
for path in search_paths:
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
if path not in sys.path:
|
| 80 |
sys.path.insert(0, path)
|
| 81 |
try:
|
| 82 |
# Test import (only available in DeepISLES Docker image)
|
| 83 |
from src.isles22_ensemble import IslesEnsemble # noqa: F401
|
| 84 |
|
| 85 |
-
logger.
|
| 86 |
return path
|
| 87 |
-
except ImportError:
|
|
|
|
| 88 |
continue
|
|
|
|
|
|
|
| 89 |
|
| 90 |
raise DeepISLESError(
|
| 91 |
"DeepISLES modules not found. Direct invocation requires running "
|
|
|
|
| 75 |
search_paths = _get_deepisles_search_paths()
|
| 76 |
|
| 77 |
for path in search_paths:
|
| 78 |
+
path_obj = Path(path)
|
| 79 |
+
if path_obj.exists():
|
| 80 |
+
# Log what we find for debugging
|
| 81 |
+
logger.info("Checking path %s - exists: True", path)
|
| 82 |
+
if (path_obj / "src").exists():
|
| 83 |
+
src_contents = list((path_obj / "src").iterdir())[:10]
|
| 84 |
+
logger.info(" /src contents: %s", [f.name for f in src_contents])
|
| 85 |
+
else:
|
| 86 |
+
logger.info(" /src does NOT exist")
|
| 87 |
+
# Check what IS in this directory
|
| 88 |
+
contents = list(path_obj.iterdir())[:10]
|
| 89 |
+
logger.info(" directory contents: %s", [f.name for f in contents])
|
| 90 |
+
|
| 91 |
if path not in sys.path:
|
| 92 |
sys.path.insert(0, path)
|
| 93 |
try:
|
| 94 |
# Test import (only available in DeepISLES Docker image)
|
| 95 |
from src.isles22_ensemble import IslesEnsemble # noqa: F401
|
| 96 |
|
| 97 |
+
logger.info("Found DeepISLES at %s", path)
|
| 98 |
return path
|
| 99 |
+
except ImportError as e:
|
| 100 |
+
logger.warning("Import failed at %s: %s", path, e)
|
| 101 |
continue
|
| 102 |
+
else:
|
| 103 |
+
logger.info("Checking path %s - exists: False", path)
|
| 104 |
|
| 105 |
raise DeepISLESError(
|
| 106 |
"DeepISLES modules not found. Direct invocation requires running "
|