WorkerConf

class WorkerConf(BaseModel):

The configuration of a worker.

TaskResult

class TaskResult(BaseModel):

The result of a task.

TaskAssignment

class TaskAssignment(BaseModel):

An individual task assignment within a batch.

TaskAssignResult

class TaskAssignResult(BaseModel):

The result of task assignment for both single and batch assignments.

check_if_running

def check_if_running(
    running: bool,
    max_retries: int = 3,
    retry_delay: float = 1.0,
    handle_exceptions: bool = False
):

Check if the workforce is (not) running, specified by the boolean value. Provides fault tolerance through automatic retries and exception handling.

Parameters:

  • running (bool): Expected running state (True or False).
  • max_retries (int, optional): Maximum number of retry attempts if the operation fails. Set to 0 to disable retries. (default: :obj:3)
  • retry_delay (float, optional): Delay in seconds between retry attempts. (default: :obj:1.0)
  • handle_exceptions (bool, optional): If True, catch and log exceptions instead of propagating them. (default: :obj:False)

Raises:

  • RuntimeError: If the workforce is not in the expected status and
  • Exception: Any exception raised by the decorated function if