Skip to content

Commit

Permalink
Update herd.py
Browse files Browse the repository at this point in the history
  • Loading branch information
orgua committed Apr 29, 2024
1 parent 293b008 commit 096278e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions software/shepherd-herd/shepherd_herd/herd.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,15 @@ def run_cmd(self, cmd: str, *, sudo: bool = False) -> dict[str, Result]:
"""
results: dict[str, Result] = {}
threads = {}
logger.debug("Sheep-CMD = %s", cmd)
logger.info("Sheep-CMD = %s", cmd)
for cnx in self.group:
_name = self.hostnames[cnx.host]
threads[_name] = threading.Thread(
target=self._thread_run,
args=(cnx, sudo, cmd, results, _name),
)
threads[_name].start()
logger.debug(" .. threads started - will wait until finished")
for host, thread in tqdm(threads.items(), desc="joining threads", unit="n"):
logger.debug(" .. joining %s-thread", host)
for host, thread in tqdm(threads.items(), desc=" .. joining threads", unit="n"):
thread.join() # timeout=10.0
if thread.is_alive():
logger.error(
Expand All @@ -260,7 +258,7 @@ def print_output(
verbose: bool = False,
) -> None:
"""Log output-results of shell commands"""
for hostname, reply in replies.values():
for hostname, reply in replies.items():
# TODO: incorrect when sheep are missing in between
# -> also throw out in hostname-dict?
if not verbose and reply.exited == 0:
Expand Down

0 comments on commit 096278e

Please sign in to comment.