archivebox.workers.supervisord_utilο
Module Contentsο
Classesο
Reuse one XML-RPC proxy until it fails, avoiding hot-loop reconnects. |
Functionsο
Return live supervisord parents recorded for this DATA_DIR. |
|
Stop older supervisord parents for this DATA_DIR after a start race. |
|
Check if a port is already in use. |
|
Read the plugin-owned Sonic config before starting its supervisord worker. |
|
Get the path to the supervisord socket file, symlinking to a shorter path if needed due to unix path length limits |
|
Create a supervisord worker config file for a given daemon |
|
Project desired workers into supervisord from ArchiveBox-owned state. |
|
Stop only the supervisord child started by this Python process. |
|
Reap the supervisord child owned by this foreground parent if it exited. |
|
Poll for supervisord readiness without a fixed startup sleep. |
|
Tail multiple log files simultaneously, interleaving their output. |
|
Dataο
APIο
- archivebox.workers.supervisord_util._desired_supervisord_workers: dict[str, dict[str, str]][source]ο
None
- archivebox.workers.supervisord_util._RUNTIME_COMPONENT_ORDER[source]ο
(βorchestratorβ, βserverβ, βsonicβ)
- archivebox.workers.supervisord_util._record_supervisord_process(proc: subprocess.Popen, config_file: pathlib.Path) None[source]ο
- archivebox.workers.supervisord_util._live_supervisord_processes_from_db()[source]ο
Return live supervisord parents recorded for this DATA_DIR.
The socket/config files are generated runtime projection and can move when TMP_DIR changes or falls back. Process rows are the durable coordination state, so takeover/shutdown must stop every live supervisord recorded for this collection, not only the one reachable at the current socket path.
- archivebox.workers.supervisord_util._stop_older_supervisord_processes(*, current_pid: int, current_started_at: float, timeout: float) None[source]ο
Stop older supervisord parents for this DATA_DIR after a start race.
Lazy daemon users such as
archivebox list --search ...may race to start Sonic. The durable Process table is the arbiter: after this parent is recorded, kill only live supervisord rows that started before this one. If another parent started later, leave it alone so newest healthy owner wins.
- archivebox.workers.supervisord_util.RUNSERVER_WORKER(host: str, port: str, *, reload: bool, nothreading: bool = False)[source]ο
- archivebox.workers.supervisord_util.is_port_in_use(host: str, port: int) bool[source]ο
Check if a port is already in use.
- archivebox.workers.supervisord_util._sonic_worker_bind_target(worker: dict[str, str]) tuple[str, int] | None[source]ο
Read the plugin-owned Sonic config before starting its supervisord worker.
- archivebox.workers.supervisord_util.get_sock_file()[source]ο
Get the path to the supervisord socket file, symlinking to a shorter path if needed due to unix path length limits
- archivebox.workers.supervisord_util.create_worker_config(daemon)[source]ο
Create a supervisord worker config file for a given daemon
- archivebox.workers.supervisord_util.sync_supervisord_workers(supervisor, workers: list[tuple[dict[str, str], bool]], *, prune: bool = True)[source]ο
Project desired workers into supervisord from ArchiveBox-owned state.
The worker conf files are generated supervisor input only. They are never treated as durable ArchiveBox state; callers either pass a complete worker set with prune=True or add one explicit worker with prune=False.
- archivebox.workers.supervisord_util.get_existing_supervisord_process(*, quiet: bool = False)[source]ο
- class archivebox.workers.supervisord_util.SupervisordConnectionCache(*, quiet: bool = False)[source]ο
Reuse one XML-RPC proxy until it fails, avoiding hot-loop reconnects.
Initialization
- archivebox.workers.supervisord_util.stop_own_supervisord_process(*, record_exit: bool = True)[source]ο
Stop only the supervisord child started by this Python process.
- archivebox.workers.supervisord_util.reap_foreground_supervisord_process() None[source]ο
Reap the supervisord child owned by this foreground parent if it exited.
- archivebox.workers.supervisord_util.wait_for_supervisord_ready(max_wait_sec: float = 5.0, interval_sec: float = 0.1, *, quiet: bool = False)[source]ο
Poll for supervisord readiness without a fixed startup sleep.
- archivebox.workers.supervisord_util.run_runner_worker(args: list[str], *, name: str = 'worker_runner_once', interactive_interrupts: bool = False) int[source]ο
- archivebox.workers.supervisord_util.format_runtime_components(components: list[str] | tuple[str, ...]) str[source]ο
- archivebox.workers.supervisord_util.worker_runtime_component(worker_name: str, *, config=None) str | None[source]ο
- archivebox.workers.supervisord_util.runtime_components_for_worker_names(worker_names: set[str] | list[str] | tuple[str, ...], *, config=None) list[str][source]ο
- archivebox.workers.supervisord_util.active_supervisord_runtime_components(*, config=None, supervisor=None) list[str][source]ο
- archivebox.workers.supervisord_util.build_server_worker_plan(*, config, host: str, port: str, debug: bool, reload: bool, nothreading: bool, supervisor=None)[source]ο
- archivebox.workers.supervisord_util.tail_multiple_worker_logs(log_files: list[str], follow=True, proc=None, keep_running=None)[source]ο
Tail multiple log files simultaneously, interleaving their output.
Args: log_files: List of log file paths to tail follow: Whether to keep following (True) or just read existing content (False) proc: Optional subprocess.Popen object - stop tailing when this process exits
- archivebox.workers.supervisord_util.get_sonic_supervisord_worker_from_plugin(config) dict[str, str] | None[source]ο
- archivebox.workers.supervisord_util._is_supervisord_process(proc: psutil.Process | None) bool[source]ο
- archivebox.workers.supervisord_util._has_live_archivebox_parent(proc: psutil.Process | None) bool[source]ο
- archivebox.workers.supervisord_util._terminate_process_tree(root: psutil.Process, *, timeout: float = 2.0) None[source]ο
- archivebox.workers.supervisord_util._sonic_listeners(host: str, port: int) list[psutil.Process][source]ο