lookout.core.sqla_model_repository¶
Module Contents¶
-
lookout.core.sqla_model_repository.Base¶
-
class
lookout.core.sqla_model_repository.Model¶ Bases:
BaseThe only object stored in the database - trained model metadata.
-
analyzer¶
-
repository¶
-
path¶
-
updated¶
-
-
class
lookout.core.sqla_model_repository.ContextSessionMaker(factory)¶ Adds the __enter__()/__exit__() to an SQLAlchemy session and thus automatically closes it.
-
class
lookout.core.sqla_model_repository.SQLAlchemyModelRepository(db_endpoint:str, fs_root:str, max_cache_mem:int, ttl:int, engine_kwargs:dict=None)¶ Bases:
lookout.core.model_repository.ModelRepositoryStores models in file system and their metadata in any database supported by SQLAlchemy.
-
MAX_SUBDIRS= 1024¶
-
get(self, model_id:str, model_type:Type[AnalyzerModel], url:str)¶
-
set(self, model_id:str, url:str, model:AnalyzerModel)¶
-
init(self)¶
-
shutdown(self)¶
-
static
split_url(url:str)¶ Explode a Git remote URL into FS-friendly pieces.
-
static
cache_key(model_id:str, model_type:Type[AnalyzerModel], url:str)¶ Compose the cache key for the given model and Git remote.
-
store_model(self, model:AnalyzerModel, model_id:str, url:str)¶ Save the model on disk.
Parameters: - model – Instance of the model to save.
- model_id – The key of the model (based on the bound analyzer name and version).
- url – Git repository remote.
Returns: The path to the saved model.
-