je_load_density.utils.reliability.process_supervisor

Process supervisor.

  • ProcessSupervisor walks the OS process table for stuck Locust / gevent workers and kills stragglers (never the current process).

  • with_watchdog() wraps a long callable with a hard wall-clock raise so a hung user template doesn’t pin a CI job forever.

Functions

kill_pid(pid[, sig])

with_watchdog(callable_, *args[, ...])

Run callable_ and raise TimeoutError if it exceeds timeout_seconds.

Classes

ProcessSupervisor(name_substrings, ...)

class je_load_density.utils.reliability.process_supervisor.ProcessSupervisor(name_substrings: tuple = ('locust', 'gevent'), grace_seconds: float = 2.0, killed: List[int] = <factory>)

Bases: object

grace_seconds: float = 2.0
kill_orphans() List[int]
killed: List[int]
name_substrings: tuple = ('locust', 'gevent')
je_load_density.utils.reliability.process_supervisor.kill_pid(pid: int, sig: int = Signals.SIGTERM) bool
je_load_density.utils.reliability.process_supervisor.with_watchdog(callable_: Callable[[...], Any], *args: Any, timeout_seconds: float = 300.0, on_timeout: Callable[[], None] | None = None, **kwargs: Any) Any

Run callable_ and raise TimeoutError if it exceeds timeout_seconds. The callable continues running in its daemon thread until the process exits.