Senum2001 commited on
Commit
388bcdc
·
1 Parent(s): 5de9e01

Add graceful handling for missing database tables in model versioning

Browse files
Files changed (1) hide show
  1. scripts/model_versioning.py +12 -2
scripts/model_versioning.py CHANGED
@@ -152,7 +152,12 @@ class ModelVersionTracker:
152
  return None
153
 
154
  except Exception as e:
155
- print(f"[Model Versioning] Error logging version: {e}")
 
 
 
 
 
156
  return None
157
 
158
  def log_training_cycle(self,
@@ -224,7 +229,12 @@ class ModelVersionTracker:
224
  return None
225
 
226
  except Exception as e:
227
- print(f"[Training History] Error logging cycle: {e}")
 
 
 
 
 
228
  return None
229
 
230
  def _calculate_parameter_changes(self, before: Dict[str, Any], after: Dict[str, Any]) -> Dict[str, Any]:
 
152
  return None
153
 
154
  except Exception as e:
155
+ # If table doesn't exist, just warn but don't fail
156
+ if "does not exist" in str(e) or "PGRST205" in str(e):
157
+ print(f"[Model Versioning] Warning: Tables not created yet. Run setup_model_versioning.py to create them.")
158
+ print(f"[Model Versioning] Version {model_state['version_id']} tracked locally only.")
159
+ else:
160
+ print(f"[Model Versioning] Error logging version: {e}")
161
  return None
162
 
163
  def log_training_cycle(self,
 
229
  return None
230
 
231
  except Exception as e:
232
+ # If table doesn't exist, just warn but don't fail
233
+ if "does not exist" in str(e) or "PGRST205" in str(e):
234
+ print(f"[Training History] Warning: Tables not created yet.")
235
+ print(f"[Training History] Cycle tracked locally only.")
236
+ else:
237
+ print(f"[Training History] Error logging cycle: {e}")
238
  return None
239
 
240
  def _calculate_parameter_changes(self, before: Dict[str, Any], after: Dict[str, Any]) -> Dict[str, Any]: