diff --git a/emission/storage/modifiable/builtin_model_storage.py b/emission/storage/modifiable/builtin_model_storage.py index 027277973..2ab0fbf8d 100644 --- a/emission/storage/modifiable/builtin_model_storage.py +++ b/emission/storage/modifiable/builtin_model_storage.py @@ -24,9 +24,11 @@ def upsert_model(self, key:str, model: ecwb.WrapperBase): """ logging.debug("upsert_doc called with key %s" % key) entry = ecwe.Entry.create_entry(self.user_id, key, model) + ## TODO: Cleanup old/obsolete models + # Cleaning up older models, before inserting new model + self.trim_model_entries(key) logging.debug("Inserting entry %s into model DB" % entry) ins_result = edb.get_model_db().insert_one(entry) - ## TODO: Cleanup old/obsolete models return ins_result.inserted_id def get_current_model(self, key:str) -> Optional[Dict]: @@ -60,7 +62,6 @@ def trim_model_entries(self, key:str): find_query = {"user_id": self.user_id, "metadata.key": key} result_it = edb.get_model_db().find(find_query).sort("metadata.write_ts", -1) result_list = list(result_it) - print(len(result_list)) if current_model_count >= K_MODEL_COUNT: # Specify the last or minimum timestamp of Kth model entry