Shepherd-Herd
Note
TODO: WORK IN PROGRESS
- class shepherd_herd.Herd(inventory: str | Path | None = None, limit: str | None = None, user: str | None = None, key_filepath: Path | None = None)
- alive() bool
Check if all remote hosts are present & responding.
Group is list of hosts with live connection,
hostnames contains all hosts in inventory
- check_status(*, warn: bool = False) bool
Return true as long as one instance is still has an active shepherd-sheep.
- Parameters:
warn
- Returns:
True is one node is still active
- find_consensus_time() tuple[datetime, float]
Find a start time in the future when all nodes should start service.
In order to run synchronously, all nodes should start at the same time. This is achieved by querying all nodes to check any large time offset, agreeing on a common time in the future and waiting for that time on each node.
- get_last_usage() timedelta | None
Gives time-delta of last testbed usage.
- inventorize(output_path: Path) bool
Collect information about the hosts, including the herd-server.
- open() None
Open Connection on all Nodes.
Can safely be called more than once, as it might re-add prior offline nodes into active host-pool.
- static print_output(replies: Mapping[str, Result], *, verbose: bool = False) None
Log output-results of shell commands.
- put_task(task: Path | ShpModel, remote_path: PurePosixPath | str = '/etc/shepherd/config.pickle') None
Transfer shepherd tasks to the group of hosts / sheep.
Rolls out a configuration file according to the given command and parameters service.
- resync() int
Get current time via ntp and restart PTP on each sheep.
- run_cmd(cmd: str, timeout: float = 3600, exclusive_host: str | None = None, *, sudo: bool = False, verbose: bool = True) dict[str, Result]
Run COMMAND on the shell -> Returns output-results.
NOTE: in case of error on a node that corresponding dict value is unavailable
- service_is_active() bool
Return true as long as one instance is still measuring.
This only monitors sheep running unattached (via systemd-service).
systemctl is-active XYZ returns with exit-code: - active -> 0 - inactive -> 3 - failed -> 3
- Returns:
True is one node is still active
- service_is_failed() bool
Return true if at least one sheep failed.
systemctl is-failed XYZ returns with exit-code: - active -> 1 - inactive -> 1 - failed -> 0
- start_measurement() int
Start shepherd service on the group of hosts.