pyqt_reactive.services.process_tracker
Process Tracker Utility
Tracks which processes are currently alive for log file status indication. Used by log viewer to distinguish logs from running vs terminated processes.
Functions
|
Extract PID from application log filename. |
|
Get display name for log file with process status indicator. |
|
Get tooltip text for log file with process information. |
Classes
|
Information about a tracked process. |
Tracks which processes are currently alive. |
- class pyqt_reactive.services.process_tracker.ProcessInfo(pid: int, name: str, status: str, create_time: float)[source]
Information about a tracked process.
- class pyqt_reactive.services.process_tracker.ProcessTracker[source]
Tracks which processes are currently alive.
Used to determine if log files correspond to running or terminated processes.
- process_info: dict[int, ProcessInfo]
- update(target_pids: Iterable[int] | None = None) bool[source]
Update tracked process state.
- Parameters:
target_pids – Optional PID set to check directly. When provided, avoids scanning every process on the machine.
- Returns:
True when tracked alive/dead state changed.
- is_alive(pid: int | None) bool[source]
Check if a PID is currently alive.
- Parameters:
pid – Process ID to check (None returns False)
- Returns:
True if process is alive, False otherwise
- Return type:
- get_process_info(pid: int) ProcessInfo | None[source]
Get information about a process.
- Parameters:
pid – Process ID
- Returns:
ProcessInfo if process is alive, None otherwise
- pyqt_reactive.services.process_tracker.extract_pid_from_log_filename(log_path: Path) int | None[source]
Extract PID from application log filename.
Supports various log filename patterns: - app_unified_20251007_102845_worker_12345.log - zmq_worker_exec_abc123_worker_12345.log - app_worker_12345.log
- Parameters:
log_path – Path to log file
- Returns:
Extracted PID, or None if no PID found
- Return type:
- pyqt_reactive.services.process_tracker.get_log_display_name(log_path: Path, process_tracker: ProcessTracker) str[source]
Get display name for log file with process status indicator.
- Parameters:
log_path – Path to log file
process_tracker – ProcessTracker instance
- Returns:
Display name with status icon (e.g., “🟢 worker_12345.log”)
- Return type:
- pyqt_reactive.services.process_tracker.get_log_tooltip(log_path: Path, process_tracker: ProcessTracker) str[source]
Get tooltip text for log file with process information.
- Parameters:
log_path – Path to log file
process_tracker – ProcessTracker instance
- Returns:
Tooltip text with process status and info
- Return type: