necst.web.process_manager¶
Local launcher process tracking for the NECST operator console.
This module only manages local subprocesses started by the console. It does not send telescope, recorder, or spectrometer commands.
- make_launcher_log_paths(log_dir, stem)[source]¶
Return unique stdout/stderr log paths under log_dir.
- Parameters:
log_dir (Path) –
stem (Any) –
- Return type:
Tuple[Path, Path]
- class ManagedProcessRecord(pid, category, label, action='', command=<factory>, stdout_path=None, stderr_path=None, started_at=<factory>, finished_at=None, returncode=None, status='running', final_logged=False, stop_requested_at=None, stop_reason='', _popen=None)[source]¶
Bases:
objectA locally launched child process tracked by the operator console.
- Parameters:
pid (int) –
category (str) –
label (str) –
action (str) –
command (List[str]) –
stdout_path (Optional[str]) –
stderr_path (Optional[str]) –
started_at (float) –
finished_at (Optional[float]) –
returncode (Optional[int]) –
status (str) –
final_logged (bool) –
stop_requested_at (Optional[float]) –
stop_reason (str) –
_popen (Optional[Popen[Any]]) –
- pid: int¶
- category: str¶
- label: str¶
- action: str = ''¶
- command: List[str]¶
- stdout_path: Optional[str] = None¶
- stderr_path: Optional[str] = None¶
- started_at: float¶
- finished_at: Optional[float] = None¶
- returncode: Optional[int] = None¶
- status: str = 'running'¶
- final_logged: bool = False¶
- stop_requested_at: Optional[float] = None¶
- stop_reason: str = ''¶
- is_active()[source]¶
Return True while the local launcher is still considered active.
Older console code and status adaptation paths use this method instead of inspecting
statusdirectly. Keeping it on the record object makes status generation robust even when a process record has not just been converted throughto_dict().- Return type:
bool
- class ProcessRegistry[source]¶
Bases:
objectThread-safe registry of console-owned launcher subprocesses.
- register_from_action_result(*, action, category, result_data, label)[source]¶
- Parameters:
action (str) –
category (str) –
result_data (Mapping[str, Any]) –
label (str) –
- Return type:
Optional[ManagedProcessRecord]
- refresh()[source]¶
- Return type:
List[ManagedProcessRecord]
- all_records(*, refresh=True)[source]¶
- Parameters:
refresh (bool) –
- Return type:
List[ManagedProcessRecord]
- active(*, category=None)[source]¶
- Parameters:
category (Optional[str]) –
- Return type:
List[ManagedProcessRecord]
- request_stop(*, pid=None, category=None, kill=False, reason='')[source]¶
- Parameters:
pid (Optional[int]) –
category (Optional[str]) –
kill (bool) –
reason (str) –
- Return type:
List[ManagedProcessRecord]