Spaces:
Running
Running
Commit ·
63f7810
1
Parent(s): fd577ad
Debug: Add logging to diagnose api_data path issue on HF Spaces
Browse files- server.py +10 -0
- src/prediction_pipeline.py +6 -1
server.py
CHANGED
|
@@ -85,13 +85,23 @@ if INITIAL_PROCESSED.exists() and not PERSISTENT_PROCESSED.exists():
|
|
| 85 |
# Copy api_data (standings, games, ELO data) to persistent storage
|
| 86 |
INITIAL_API_DATA = ROOT_DIR / "data" / "api_data"
|
| 87 |
PERSISTENT_API_DATA = PERSISTENT_DIR / "api_data"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
if INITIAL_API_DATA.exists() and not PERSISTENT_API_DATA.exists():
|
| 89 |
logger.info("Copying initial API data (standings, games) to persistent storage...")
|
| 90 |
shutil.copytree(INITIAL_API_DATA, PERSISTENT_API_DATA)
|
|
|
|
|
|
|
| 91 |
|
| 92 |
# Update environment to use persistent paths
|
| 93 |
os.environ["NBA_ML_DATA_DIR"] = str(PERSISTENT_DIR)
|
| 94 |
os.environ["NBA_ML_MODELS_DIR"] = str(PERSISTENT_MODELS_DIR)
|
|
|
|
| 95 |
|
| 96 |
# Add project root to path
|
| 97 |
sys.path.insert(0, str(ROOT_DIR))
|
|
|
|
| 85 |
# Copy api_data (standings, games, ELO data) to persistent storage
|
| 86 |
INITIAL_API_DATA = ROOT_DIR / "data" / "api_data"
|
| 87 |
PERSISTENT_API_DATA = PERSISTENT_DIR / "api_data"
|
| 88 |
+
logger.info(f"INITIAL_API_DATA path: {INITIAL_API_DATA}")
|
| 89 |
+
logger.info(f"INITIAL_API_DATA exists: {INITIAL_API_DATA.exists()}")
|
| 90 |
+
if INITIAL_API_DATA.exists():
|
| 91 |
+
logger.info(f"INITIAL_API_DATA files: {len(list(INITIAL_API_DATA.glob('*')))}")
|
| 92 |
+
logger.info(f"PERSISTENT_API_DATA path: {PERSISTENT_API_DATA}")
|
| 93 |
+
logger.info(f"PERSISTENT_API_DATA exists: {PERSISTENT_API_DATA.exists()}")
|
| 94 |
+
|
| 95 |
if INITIAL_API_DATA.exists() and not PERSISTENT_API_DATA.exists():
|
| 96 |
logger.info("Copying initial API data (standings, games) to persistent storage...")
|
| 97 |
shutil.copytree(INITIAL_API_DATA, PERSISTENT_API_DATA)
|
| 98 |
+
elif INITIAL_API_DATA.exists() and PERSISTENT_API_DATA.exists():
|
| 99 |
+
logger.info("API data already in persistent storage")
|
| 100 |
|
| 101 |
# Update environment to use persistent paths
|
| 102 |
os.environ["NBA_ML_DATA_DIR"] = str(PERSISTENT_DIR)
|
| 103 |
os.environ["NBA_ML_MODELS_DIR"] = str(PERSISTENT_MODELS_DIR)
|
| 104 |
+
logger.info(f"Set NBA_ML_DATA_DIR to: {PERSISTENT_DIR}")
|
| 105 |
|
| 106 |
# Add project root to path
|
| 107 |
sys.path.insert(0, str(ROOT_DIR))
|
src/prediction_pipeline.py
CHANGED
|
@@ -72,8 +72,13 @@ class PredictionPipeline:
|
|
| 72 |
from src.config import API_CACHE_DIR
|
| 73 |
|
| 74 |
games_path = API_CACHE_DIR / "all_games_summary.parquet"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
if not games_path.exists():
|
| 76 |
-
logger.warning("No historical game data found for ELO initialization")
|
| 77 |
return
|
| 78 |
|
| 79 |
games_df = pd.read_parquet(games_path)
|
|
|
|
| 72 |
from src.config import API_CACHE_DIR
|
| 73 |
|
| 74 |
games_path = API_CACHE_DIR / "all_games_summary.parquet"
|
| 75 |
+
logger.info(f"Looking for ELO data at: {games_path}")
|
| 76 |
+
logger.info(f"API_CACHE_DIR exists: {API_CACHE_DIR.exists()}")
|
| 77 |
+
if API_CACHE_DIR.exists():
|
| 78 |
+
logger.info(f"API_CACHE_DIR contents: {list(API_CACHE_DIR.glob('*.parquet'))[:5]}")
|
| 79 |
+
|
| 80 |
if not games_path.exists():
|
| 81 |
+
logger.warning(f"No historical game data found for ELO initialization at {games_path}")
|
| 82 |
return
|
| 83 |
|
| 84 |
games_df = pd.read_parquet(games_path)
|