Add noticing when things are taking a long time and printing out which ones.

This commit is contained in:
Cassowary Rusnov 2024-10-24 10:21:58 -07:00
parent d8deaaf456
commit d33fba81bb
2 changed files with 9 additions and 0 deletions

View File

@ -22,6 +22,7 @@
# - Add variables that can be set and passed to commands # - Add variables that can be set and passed to commands
# - implement various commented commands in the command list # - implement various commented commands in the command list
# - implement interactive alias system # - implement interactive alias system
# - Catch more exceptions in fabtools, and also add retries
import argparse import argparse

View File

@ -1,3 +1,5 @@
import time
from pathlib import Path from pathlib import Path
from threading import Thread, Lock from threading import Thread, Lock
@ -31,9 +33,11 @@ class HostSet:
resq = [] resq = []
reslock = Lock() reslock = Lock()
threads = [] threads = []
tupdate = time.time()
prog = tqdm(total=len(self.connections), unit="hosts") prog = tqdm(total=len(self.connections), unit="hosts")
for connection in self.connections: for connection in self.connections:
t = Thread(target=thread_run, args=[connection, command, reslock, resq]) t = Thread(target=thread_run, args=[connection, command, reslock, resq])
t.host = connection.original_host
t.start() t.start()
threads.append(t) threads.append(t)
@ -50,6 +54,10 @@ class HostSet:
threads = nt threads = nt
if len(threads) == 0: if len(threads) == 0:
break break
else:
if ((time.time() - tupdate) > 10.0):
tupdate = time.time()
print("Still waiting on ", [thread.host for thread in threads])
prog.close() prog.close()
# Gather up results by output # Gather up results by output