Skip to main content

modeller_runner

Utility functions for running modellers from configs.

Module

Functions

run_modeller

def run_modeller(    modeller: _Modeller,    pod_identifiers: Iterable[str],    require_all_pods: bool = False,    model_out: Optional[Path] = PosixPath('output-model.pt'),    project_id: Optional[str] = None,    run_on_new_data_only: bool = False,    batched_execution: Optional[bool] = None,)> 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".
  • project_id: Project Id the task belongs to. Defaults to None.
  • run_on_new_data_only: Whether to run the task on new datapoints only. Defaults to False.
  • batched_execution: Whether to run the task in batched mode. Defaults to False.

Raises

  • PodResponseError: If require_all_pods is true and at least one pod identifier specified rejects or fails to respond to a task request.

run_modeller_async

async def run_modeller_async(    modeller: _Modeller,    pod_identifiers: Iterable[str],    require_all_pods: bool = False,    model_out: Optional[Path] = PosixPath('output-model.pt'),    project_id: Optional[str] = None,    run_on_new_data_only: bool = False,    batched_execution: Optional[bool] = None,)> 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".
  • project_id: Project Id the task belongs to.
  • run_on_new_data_only: Whether to run the task on new datapoints only. Defaults to False.
  • batched_execution: Whether to run the task in batched mode. Defaults to False.

Raises

  • PodResponseError: If require_all_pods is true and at least one pod identifier specified rejects or fails to respond to a task request.

setup_modeller

def setup_modeller(    pod_identifiers: list[str],    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,    project_id: Optional[str] = None,)> _Modeller:

Creates a modeller.

Arguments

  • pod_identifiers: The pod identifiers of the pods 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.
  • project_id: The project ID the task belongs to.

Returns The created Modeller.

setup_modeller_from_config

def setup_modeller_from_config(config: ModellerConfig)> tuple:

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.

setup_modeller_from_config_file

def setup_modeller_from_config_file(path_to_config_yaml: Union[str, PathLike])> tuple:

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