Skip to main content

modeller_runner

Utility functions for running modellers from configs.

Module

Functions

def run_modeller(    modeller: _Modeller,    pod_identifiers: Iterable[str],    require_all_pods: bool = False,    model_out: Path = PosixPath('output-model.pt'),)> Optional[Any]:

Runs the modeller.

Run the modeller, submitting tasks to the pods and waiting for the results.

Arguments

  • modeller: The Modeller instance being used to manage the task.
  • pod_identifiers: The group of pod identifiers to run the task against.
  • require_all_pods: Require all pod identifiers specified to accept the task request to complete task execution.
  • model_out: The path to save the model out to. Defaults to "./output-model.pt".

Raises

  • PodResponseError: If require_all_pods is true and at least one pod identifier specifed rejects or fails to respond to a task request.
async def run_modeller_async(    modeller: _Modeller,    pod_identifiers: Iterable[str],    require_all_pods: bool = False,    model_out: Path = PosixPath('output-model.pt'),)> Optional[Any]:

Runs the modeller.

Run the modeller, submitting tasks to the pods and waiting for the results.

Arguments

  • modeller: The Modeller instance being used to manage the task.
  • pod_identifiers: The group of pod identifiers to run the task against.
  • require_all_pods: Require all pod identifiers specified to accept the task request to complete task execution.
  • model_out: The path to save the model out to. Defaults to "./output-model.pt".

Raises

  • PodResponseError: If require_all_pods is true and at least one pod identifier specifed rejects or fails to respond to a task request.
def setup_modeller(    pod_identifiers: List[str],    data_config: DataStructureConfig,    task_details: TaskConfig,    bitfount_hub: BitfountHub,    ms_config: MessageServiceConfig,    identity_verification_method: Union[str, IdentityVerificationMethod] = IdentityVerificationMethod.OIDC_DEVICE_CODE,    private_key_file: Optional[Path] = None,    idp_url: Optional[str] = None,)> _Modeller:

Creates a modeller.

Arguments

  • pod_identifiers: The pod identifiers of the pods to be used in the task.
  • data_config: The details of the data schema and options to be used in the task.
  • task_details: The task details as a TaskConfig instance.
  • bitfount_hub: The BitfountHub instance.
  • ms_config: The message service settings as a MessageServiceConfig instance.
  • identity_verification_method: The identity verification method to use.
  • private_key_file: The path to the private key used by this modeller.
  • idp_url: URL of the modeller's identity provider.

Returns The created Modeller.

def setup_modeller_from_config(    config: ModellerConfig,)> Tuple[bitfount.federated.modeller._Modeller, List[str]]:

Creates a modeller from a loaded config mapping.

Arguments

  • config: The modeller configuration.

Returns A tuple of the created Modeller and the list of pod identifiers to run the task against.

def setup_modeller_from_config_file(    path_to_config_yaml: Union[str, PathLike],)> Tuple[bitfount.federated.modeller._Modeller, List[str]]:

Creates a modeller from a YAML config file.

Arguments

  • path_to_config_yaml: the path to the config file

Returns A tuple of the created Modeller and the list of pod identifiers to run