Skip to main content

exceptions

Custom exceptions for the federated package.

Classes​

AggregatorError​

class AggregatorError(*args, **kwargs):

Error related to Aggregator classes.

Ancestors​

AlgorithmError​

class AlgorithmError(*args, **kwargs):

Error raised during a worker-side algorithm run.

Ancestors​

BatchResilienceAbortError​

class BatchResilienceAbortError(    error_message: str,    consecutive_failures: int | None = None,    failed_batches: dict[int, Exception] | None = None,):

Error raised when batch resilience system aborts due to consecutive failures.

Arguments

  • error_message: Description of why the task was aborted.
  • consecutive_failures: Number of consecutive failures that triggered abort.
  • failed_batches: Dictionary mapping batch numbers to their exceptions.

Ancestors​

BitfountTaskStartError​

class BitfountTaskStartError(*args, **kwargs):

Raised when an issue occurs whilst trying to start a task with pods.

Ancestors​

CancellationStatus​

class CancellationStatus(*args, **kwds):

Outcome of a user-initiated cancellation request.

Ancestors​

Variables​

  • static CONFIRMED
  • static NO_WORKERS
  • static PARTIAL

ChildConfigEndpointError​

class ChildConfigEndpointError(status_code: int, response_text: str, kind: str):

Raised when the pod's child-config endpoint refuses or cannot answer.

Covers both a non-200 answer and an unreachable server, because a background DAG child can do nothing different about either: a run that cannot get its credentials from the pod that launched it cannot run.

Ancestors​

DPNotAppliedError​

class DPNotAppliedError(*args, **kwargs):

Error if DP could not be applied to a model.

Ancestors​

DPParameterError​

class DPParameterError(*args, **kwargs):

Error if any of given dp params are not allowed.

Ancestors​

DataProcessingError​

class DataProcessingError(*args, **kwargs):

Error related to data processing.

This is distinct from DataSourceError, as it is related to later processing of the data. Raised by the ophthalmology algorithms.

Ancestors​

EHRConnectionError​

class EHRConnectionError(failed_patients: int):

Raised when the EHR keeps rejecting requests as unauthenticated.

Token refreshes succeed, but the EHR server keeps answering 401, which points to a systemic credentials or permissions problem. An EHR connection raises it once too many requests in a row were rejected (AuthFailureBudget); a caller's per-patient counter raises it once too many patients in a row were.

Arguments

  • failed_patients: How many failures in a row were counted: requests for a connection, patients for a caller's counter.

Ancestors​

EHRNotConfiguredError​

class EHRNotConfiguredError(message: str):

Raised when a DAG needs a live EHR resource and the pod has none.

The EHR resource identity is only computable from pod.ehr_config, which is set once at pod construction and never mutated. A pod with no EHR block has never written an ehr_data row, so there is no fallback to serve: this is a startup-time misconfiguration, not a transient EHR outage.

It is raised only when at least one of the DAG's steps declares requires_ehr_data_resource and so raises on a None resource (ehr_query v1/v2, ehr_patient_lister v1). A DAG whose EHR steps all tolerate a missing resource hashes under a sentinel identity instead and runs degraded — see flows.dag.setup._resource_identities.

Ancestors​

EHROrchestratorError​

class EHROrchestratorError(status_code: int, response_text: str):

Raised when the EHR token endpoint in orchestrator is unreachable/failing.

EHRTokenError​

class EHRTokenError(error: str, error_type: EHRTokenErrorType):

Raised when the app is unable to provide a valid EHR token.

This exception is raised in the pod process when unrecoverable token errors are encountered (e.g. EHR is down, internal app errors) or when the retry budget for network errors has been exhausted.

Ancestors​

EHRTokenErrorType​

class EHRTokenErrorType(*args, **kwds):

Types of errors that can occur when requesting an EHR token from the app.

Variables​

  • static EHR_ERROR - The EHR rejected the token request. Do not retry.
  • static INTERNAL_ERROR - An unexpected error occurred in the app. Do not retry.
  • static NETWORK_ERROR - The app could not reach the EHR. Retry for a while before giving up.
  • static NOT_CONFIGURED - The app has no EHR set up to get a token from. Do not retry.

EHRTokenNotConfiguredError​

class EHRTokenNotConfiguredError(error: str):

Raised when the app answers that it has no EHR to get a token from.

A final answer rather than a failure: nothing will change until someone sets up an EHR in the app, so callers should stop asking rather than retry. Subclasses EHRTokenError so existing handlers of that still catch it.

MessageHandlerDispatchError​

class MessageHandlerDispatchError(*args, **kwargs):

Error raised when there is a problem dispatching messages to handlers.

Ancestors​

MessageHandlerNotFoundError​

class MessageHandlerNotFoundError(*args, **kwargs):

Error raised when no registered message handler can be found.

MessageRetrievalError​

class MessageRetrievalError(*args, **kwargs):

Raised when an error occurs whilst retrieving a message from message service.

Ancestors​

MessageTypeSpecificHandlerNotFoundError​

class MessageTypeSpecificHandlerNotFoundError(*args, **kwargs):

Error raised when no non-universal registered message handler can be found.

Variables​

  • static universal_dispatches : list[ConcurrentFuture | _PriorityHandler]

NoDataError​

class NoDataError(*args, **kwargs):

Error when no data is found.

Ancestors​

NoNewDataError​

class NoNewDataError(*args, **kwargs):

Error when run_on_new_data_only is True but no new records are found.

Ancestors​

OrchestratorTokenEndpointError​

class OrchestratorTokenEndpointError(    status_code: int, response_text: str, token_type: str,):

Raised when the orchestrator token endpoint is unreachable or failing.

This represents persistent non-200 responses from the local orchestrator HTTP token endpoint, independent of token type (oauth/ehr).

Ancestors​

PodConnectFailedError​

class PodConnectFailedError(*args, **kwargs):

The message service has not correctly connected the pod.

Ancestors​

PodNameError​

class PodNameError(*args, **kwargs):

Error related to given Pod name.

Ancestors​

PodRegistrationError​

class PodRegistrationError(*args, **kwargs):

Error related to registering a Pod with BitfountHub.

Ancestors​

PodResponseError​

class PodResponseError(*args, **kwargs):

Pod rejected or failed to respond to a task request.

Ancestors​

PrivateSqlError​

class PrivateSqlError(*args, **kwargs):

An exception for any issues relating to the PrivateSQL algorithm.

Ancestors​

ProtocolError​

class ProtocolError(*args, **kwargs):

Error raised during protocol run.

Ancestors​

TaskAbortError​

class TaskAbortError(    error_message: str, reason: Reason | None = None, message_already_sent: bool = False,):

Error raised when a TASK_ABORT is received from a pod.

Initialises TaskAbortError.

Arguments

  • error_message: Describes the reason for the task being aborted.
  • reason: Machine-reasable reason for the task being aborted.
  • message_already_sent: Whether a message has already been sent to the "other side" (i.e. modeller or pod) of the task run, or whether a TASK_ABORT message still needs to be sent.

Ancestors​

Subclasses​

TaskCancelled​

class TaskCancelled(    error_message: str,    cancellation_status: CancellationStatus,    reason: Reason | None = Reason.CANCELLED_BY_MODELLER,):

Raised when a task is cancelled by the user.

Subclass of TaskAbortError so existing abort handling still catches it, while allowing callers to distinguish a user-initiated cancellation from a worker-initiated abort.

Initialises TaskAbortError.

Arguments

  • error_message: Describes the reason for the task being aborted.
  • reason: Machine-reasable reason for the task being aborted.
  • message_already_sent: Whether a message has already been sent to the "other side" (i.e. modeller or pod) of the task run, or whether a TASK_ABORT message still needs to be sent.

TokenRequestUnansweredError​

class TokenRequestUnansweredError(token_type: str, cycles: int):

Raised when the desktop app never delivers a requested token.

Distinct from OrchestratorTokenEndpointError: the local endpoint accepted the request, so there is no failing status code to report - the app simply never put a token on the queue. Bounding this is what stops a caller blocking forever while holding the session's reauthentication lock.

Ancestors​

WorkerProcessSpawnError​

class WorkerProcessSpawnError(    process_name: str, attempts: int, original_exception: Exception | None,):

Raised when the worker child process fails to start after all retry attempts.

Attributes

  • process_name: Name of the process that failed to start.
  • attempts: Number of attempts made before failure.
  • original_exception: The underlying exception that caused the failure, or None if the process never attempted to start.

Ancestors​