Metadata Connectors Factory#
The base factory class that allows for creation of the metadata connector.
- class fma_core.workflows.metadata_connectors_factory.BaseMetadataConnector(settings: Dict)#
Bases:
ABC
The metadata connector object used for connection to FMA setup.
Initialization function for the metadata connector.
- Parameters:
settings (Dict) – The settings that will be used to initialize the metadata connector
- classmethod create(meta_connector_type: str, meta_connector_settings: Optional[Dict] = None) ClassVar #
Creates subclass of metadata connector.
- Parameters:
meta_connector_type (str) – The subclass of metadata connector to be created
meta_connector_settings (Dict, optional) – The settings to initialize the connector, defaults to None
- Raises:
ValueError – meta_connector_type not in BaseMetadataConnector subclass
- Returns:
A valid subclass object of BaseMetadataConnector
- Return type:
ClassVar
- abstract pull_federated_model_w_id(fed_model_id: int) Any #
Pulls a FederatedModel using its id.
- Parameters:
fed_model_id (int) – The id of the FederatedModel targeted for pull
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract pull_latest_model_aggregate(model: Any) Any #
Pulls the latest ModelAggregate in a FederatedModel.
- Parameters:
model (Any) – FederatedModel object
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract pull_model_updates_ready_for_aggregation(model: Any, parent_agg: Any) List[Any] #
Pulls all ModelUpdates ready to be included in an aggregation.
- Parameters:
model (Any) – FederatedModel object
parent_agg (Any) – The parent aggregate of the ModelUpdates used
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract pull_model_requirements(model: Any) Any #
Pulls FederatedModel aggregation requirements and their args.
- Parameters:
model (Any) – FederatedModel object
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract register_model_updates_for_aggregation(model_updates: List[Any])#
Updates status of a list of ModelUpdates to register for aggregation.
- Parameters:
model_updates (List[Any]) – A list of model updates
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract pull_model_updates_registered_for_aggregation(model: Any) List[Any] #
Pulls all ModelUpdates registered to be included in an aggregation.
- Parameters:
model (Any) – FederatedModel object
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract post_new_model_aggregate(model: Any, parent_agg: Any, results: List[Any]) Any #
Creates an entry in a DB of a new ModelAggregate.
- Parameters:
model (Any) – FederatedModel object
parent_agg (Any) – The aggregate that the ModelUpdates included were based on
results (List[Any]) – The data associated with the ModelAggregate being stored
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract pull_model_updates_pending_aggregation(model: Any) List[Any] #
Pulls all ModelUpdates pending inclusion to an aggregation task.
- Parameters:
model (Any) – FederatedModel object
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract register_model_update_used_in_aggregate(model_updates: List[Any], aggregate: Any)#
Registers that a list of ModelUpdates were used in an aggregate.
- Parameters:
model_updates (List[Any]) – List of model updates
aggregate (Any) – ModelAggregate object
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract register_model_updates_use_in_aggregation_complete(model_updates: List[Any], is_successful: Any)#
Updates status of a list of ModelUpdates to “completed” on an aggregation.
- Parameters:
model_updates (List[Any]) – A list of model updates
is_successful (Any) – Boolean value for if the aggregation task was completed successfully
- Raises:
NotImplementedError – method to be implemented in subclass
- abstract update_database()#
Updated the database.
- Raises:
NotImplementedError – method to be implemented in subclass