pyfebiopt.monitoring.service

CLI helpers for installing and running the monitoring service.

Attributes

UNIT_TEMPLATE

Functions

ensure_dependencies(→ None)

Ensure the optional monitoring stack is available.

run_service(→ int)

Start the monitoring web service with the given overrides.

install_service(→ None)

Install the systemd unit for the monitoring service.

uninstall_service(→ None)

Disable and remove the monitoring systemd unit.

parse_args(→ argparse.Namespace)

Parse the CLI arguments for the monitoring helper.

main(→ int)

Dispatch commands from the monitoring helper CLI.

Module Contents

pyfebiopt.monitoring.service.UNIT_TEMPLATE = Multiline-String
Show Value
"""[Unit]
Description=pyfebiopt monitoring web service
After=network.target

[Service]
Type=simple
ExecStart={python} -m pyfebiopt.monitoring.service run --registry {registry} --socket {socket} --host {host} --port {port}
Restart=on-failure
RestartSec=2

[Install]
WantedBy=default.target
"""
pyfebiopt.monitoring.service.ensure_dependencies() None

Ensure the optional monitoring stack is available.

pyfebiopt.monitoring.service.run_service(*, registry: pathlib.Path | None = None, socket: pathlib.Path | None = None, host: str | None = None, port: int | None = None) int

Start the monitoring web service with the given overrides.

Returns:

Process exit code (0 on normal exit).

Return type:

int

pyfebiopt.monitoring.service.install_service(*, user: bool = True, force: bool = False, host: str = '127.0.0.1', port: int = 8765) None

Install the systemd unit for the monitoring service.

pyfebiopt.monitoring.service.uninstall_service(*, user: bool = True) None

Disable and remove the monitoring systemd unit.

pyfebiopt.monitoring.service.parse_args(argv: list[str] | None = None) argparse.Namespace

Parse the CLI arguments for the monitoring helper.

Returns:

Parsed arguments.

Return type:

argparse.Namespace

pyfebiopt.monitoring.service.main(argv: list[str] | None = None) int

Dispatch commands from the monitoring helper CLI.

Returns:

Process exit code.

Return type:

int