Skip to main content

types

Types related to transport layer sending and receiving.

Module

Functions

format_exception_for_abort

def format_exception_for_abort(    exc: BaseException, max_chars: int = 2000,)> tuple[str, str]:

Extract exception metadata for inclusion in a TASK_ABORT message body.

Returns a (exception_type, traceback_summary) tuple where:

  • exception_type is the fully-qualified class name (e.g. "bitfount.data.exceptions.NoDataError").
  • traceback_summary is the formatted Python traceback string (the same output as traceback.format_exception), truncated from the head so that the most recent stack frames — the ones closest to the actual failure — are always preserved. If the full traceback exceeds max_chars it is prefixed with "..." to indicate truncation.

Arguments

  • exc: The exception to extract metadata from.
  • max_chars: Maximum length of the traceback string. Defaults to _TRACEBACK_MAX_CHARS (2 000).

Classes

CommunicationDetails

class CommunicationDetails(    mailbox_id: ForwardRef('str'),    pod_mailbox_ids: ForwardRef('dict[str, str]'),    task_id: ForwardRef('str'),):

Container for received communication details.

Variables

  • mailbox_id : str - Alias for field number 0
  • pod_mailbox_ids : dict[str, str] - Alias for field number 1
  • task_id : str - Alias for field number 2

Reason

class Reason(*args, **kwds):

Machine-readable reason for the message to have been triggered.

Ancestors

Variables

  • static CANCELLED_BY_MODELLER
  • static DATA_NOT_AVAILABLE
  • static EHR_ERROR
  • static LIMITS_EXCEEDED
  • static MODELLER_TIMEOUT
  • static NO_DATA
  • static NO_NEW_DATA
  • static TASK_COMPLETE_MODELLER_TIMEOUT
  • static WORKER_ERROR

TaskAbortBody

class TaskAbortBody(*args, **kwargs):

Body of a TASK_ABORT message.

Attributes

  • message: Human-readable description of why the task was aborted.
  • reason: Machine-readable abort reason key (maps to Reason enum).
  • exception_type: Fully-qualified class name of the exception that caused the abort (e.g. "bitfount.data.exceptions.NoDataError"). Optional for backwards compatibility with old SDK workers.
  • traceback_summary: Formatted Python traceback string captured at the point of failure, truncated to _TRACEBACK_MAX_CHARS characters from the tail so the most recent frames are always preserved. Optional for backwards compatibility with old SDK workers.

Variables

  • static exception_type : Optional[str]
  • static message : Optional[str]
  • static reason : Optional[Literal['WORKER_ERROR', 'NO_NEW_DATA', 'MODELLER_TIMEOUT', 'NO_DATA', 'LIMITS_EXCEEDED', 'TASK_COMPLETE_MODELLER_TIMEOUT', 'DATA_NOT_AVAILABLE', 'CANCELLED_BY_MODELLER', 'EHR_ERROR']]
  • static traceback_summary : Optional[str]