From d33fba81bbf27ebcec5249e943e18e6032cd090d Mon Sep 17 00:00:00 2001 From: Cassowary Date: Thu, 24 Oct 2024 10:21:58 -0700 Subject: [PATCH] Add noticing when things are taking a long time and printing out which ones. --- multiball/__main__.py | 1 + multiball/fabtools.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/multiball/__main__.py b/multiball/__main__.py index 4b63ac8..0707be9 100644 --- a/multiball/__main__.py +++ b/multiball/__main__.py @@ -22,6 +22,7 @@ # - Add variables that can be set and passed to commands # - implement various commented commands in the command list # - implement interactive alias system +# - Catch more exceptions in fabtools, and also add retries import argparse diff --git a/multiball/fabtools.py b/multiball/fabtools.py index fab06c2..394bfcf 100644 --- a/multiball/fabtools.py +++ b/multiball/fabtools.py @@ -1,3 +1,5 @@ +import time + from pathlib import Path from threading import Thread, Lock @@ -31,9 +33,11 @@ class HostSet: resq = [] reslock = Lock() threads = [] + tupdate = time.time() prog = tqdm(total=len(self.connections), unit="hosts") for connection in self.connections: t = Thread(target=thread_run, args=[connection, command, reslock, resq]) + t.host = connection.original_host t.start() threads.append(t) @@ -50,6 +54,10 @@ class HostSet: threads = nt if len(threads) == 0: break + else: + if ((time.time() - tupdate) > 10.0): + tupdate = time.time() + print("Still waiting on ", [thread.host for thread in threads]) prog.close() # Gather up results by output