archivebox.core.takeover_util

Module Contents

Functions

runtime_stack_owner_types

foreground_runner_owner_types

current_command

live_processes

newest_live_process

command_is_newest

runtime_stack_owner

command_owns_runtime_stack

foreground_runner_owner

command_owns_foreground_runner

runtime_stack_component_label

ensure_daemon_stack

healthy_orchestrator

_runner_sort_key

live_runner_processes

enter_single_runner_gate

Admit exactly one active runner for this DATA_DIR using Process rows.

standby_until_leader_needed

standby_until_runtime_stack_needed

standby_until_foreground_runner_needed

Data

RUNNER_ACTIVE_WORKER_TYPE

RUNNER_WAITING_WORKER_TYPE

RUNNER_GATE_WORKER_TYPES

API

archivebox.core.takeover_util.RUNNER_ACTIVE_WORKER_TYPE[source]

‘worker_runner’

archivebox.core.takeover_util.RUNNER_WAITING_WORKER_TYPE[source]

‘runner_waiting’

archivebox.core.takeover_util.RUNNER_GATE_WORKER_TYPES[source]

()

archivebox.core.takeover_util.runtime_stack_owner_types()[source]
archivebox.core.takeover_util.foreground_runner_owner_types()[source]
archivebox.core.takeover_util.current_command(process_type: str, *, data_dir: str | pathlib.Path, url: str | None = None)[source]
archivebox.core.takeover_util.live_processes(*, process_type: str, data_dir: str | pathlib.Path, url: str | None = None)[source]
archivebox.core.takeover_util.newest_live_process(*, process_type: str, data_dir: str | pathlib.Path, url: str | None = None)[source]
archivebox.core.takeover_util.command_is_newest(command, *, process_type: str, data_dir: str | pathlib.Path, url: str | None = None) bool[source]
archivebox.core.takeover_util.runtime_stack_owner(*, data_dir: str | pathlib.Path, exclude_id=None)[source]
archivebox.core.takeover_util.command_owns_runtime_stack(command, *, data_dir: str | pathlib.Path) bool[source]
archivebox.core.takeover_util.foreground_runner_owner(*, data_dir: str | pathlib.Path, exclude_id=None)[source]
archivebox.core.takeover_util.command_owns_foreground_runner(command, *, data_dir: str | pathlib.Path) bool[source]
archivebox.core.takeover_util.runtime_stack_component_label(*, owner=None, data_dir: str | pathlib.Path) str[source]
archivebox.core.takeover_util.ensure_daemon_stack(*, reason: str = '')[source]
archivebox.core.takeover_util.healthy_orchestrator(*, data_dir: str | pathlib.Path)[source]
archivebox.core.takeover_util._runner_sort_key(process)[source]
archivebox.core.takeover_util.live_runner_processes(*, data_dir: str | pathlib.Path, exclude_id=None)[source]
archivebox.core.takeover_util.enter_single_runner_gate(command, *, data_dir: str | pathlib.Path, graceful_timeout: float = 5.0) bool[source]

Admit exactly one active runner for this DATA_DIR using Process rows.

The current process is a real OS process while it waits, so we keep its Process row RUNNING but mark worker_type=runner_waiting. Only the process that wins takeover is promoted to worker_type=worker_runner, which is protected by a partial unique DB constraint. Older runners are terminated and fully waited out before promotion, so the runner work loop never overlaps.

archivebox.core.takeover_util.standby_until_leader_needed(command, *, process_type: str, data_dir: str | pathlib.Path, url: str | None = None, interval: float = 2.0) None[source]
archivebox.core.takeover_util.standby_until_runtime_stack_needed(command, *, data_dir: str | pathlib.Path, interval: float = 2.0) dict[str, object][source]
archivebox.core.takeover_util.standby_until_foreground_runner_needed(command, *, data_dir: str | pathlib.Path, interval: float = 2.0) dict[str, object][source]