Shepherd-Herd

Note

TODO: WORK IN PROGRESS

class shepherd_herd.Herd(inventory: str | 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 measuring.

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.

static print_output(replies: dict[str, Result], *, verbose: bool = False) None

Log output-results of shell commands.

put_task(task: Path | ShpModel, remote_path: PurePosixPath | str = '/etc/shepherd/config.yaml') 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, 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

start_measurement() int

Start shepherd service on the group of hosts.