lookout.core.model_repository

Module Contents

class lookout.core.model_repository.ModelRepository

Interface to retrieve and update the ML models. Injected into AnalyzerManager.

get(self, model_id:str, model_type:Type[AnalyzerModel], url:str)

Return the model for the specified key (model_id) and the repository (url). model_type is used to return the correct class instance.

Parameters:
  • model_id – The key of the model (based on the bound analyzer name and version).
  • model_type – Class of the model to return the instance of.
  • url – Git repository remote.
Returns:

an AnalyzerModel instance and the boolean which indicates whether a cache miss happened. Returns None instead of the model in case no models were found.

set(self, model_id:str, url:str, model:AnalyzerModel)

Put the new model into the storage for the specified key (model_id) and the repository (url).

Parameters:
  • model_id – The key of the model (based on the bound analyzer name and version).
  • url – Git repository remote.
  • model – The instance of the model to store.
Returns:

None

init(self)

Initialize the persistent data structures of this storage.

shutdown(self)

Free the resources allocated by the storage.