multiSSH3 5.50__tar.gz → 5.51__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of multiSSH3 might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: multiSSH3
3
- Version: 5.50
3
+ Version: 5.51
4
4
  Summary: Run commands on multiple hosts via SSH
5
5
  Home-page: https://github.com/yufei-pan/multiSSH3
6
6
  Author: Yufei Pan
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: multiSSH3
3
- Version: 5.50
3
+ Version: 5.51
4
4
  Summary: Run commands on multiple hosts via SSH
5
5
  Home-page: https://github.com/yufei-pan/multiSSH3
6
6
  Author: Yufei Pan
@@ -1,4 +1,11 @@
1
1
  #!/usr/bin/env python3
2
+ # /// script
3
+ # requires-python = ">=3.6"
4
+ # dependencies = [
5
+ # "argparse",
6
+ # "ipaddress",
7
+ # ]
8
+ # ///
2
9
  __curses_available = False
3
10
  __resource_lib_available = False
4
11
  try:
@@ -47,7 +54,7 @@ except AttributeError:
47
54
  # If neither is available, use a dummy decorator
48
55
  def cache_decorator(func):
49
56
  return func
50
- version = '5.50'
57
+ version = '5.51'
51
58
  VERSION = version
52
59
  __version__ = version
53
60
  COMMIT_DATE = '2025-01-30'
@@ -1359,7 +1366,7 @@ def run_command(host, sem, timeout=60,passwds=None, retry_limit = 5):
1359
1366
  # Monitor the subprocess and terminate it after the timeout
1360
1367
  host.lastUpdateTime = time.time()
1361
1368
  timeoutLineAppended = False
1362
- sleep_interval = 1.0e-8 # 10 nanoseconds
1369
+ sleep_interval = 1.0e-7 # 100 nanoseconds
1363
1370
  while proc.poll() is None: # while the process is still running
1364
1371
  if timeout > 0:
1365
1372
  if time.time() - host.lastUpdateTime > timeout:
@@ -2264,13 +2271,27 @@ def print_output(hosts,usejson = False,quiet = False,greppable = False):
2264
2271
  def processRunOnHosts(timeout, password, max_connections, hosts, returnUnfinished, nowatch, json, called, greppable,unavailableHosts,willUpdateUnreachableHosts,curses_min_char_len = DEFAULT_CURSES_MINIMUM_CHAR_LEN, curses_min_line_len = DEFAULT_CURSES_MINIMUM_LINE_LEN,single_window = DEFAULT_SINGLE_WINDOW):
2265
2272
  global __globalUnavailableHosts
2266
2273
  global _no_env
2274
+ sleep_interval = 1.0e-7 # 0.1 microseconds
2267
2275
  threads = start_run_on_hosts(hosts, timeout=timeout,password=password,max_connections=max_connections)
2268
- if __curses_available and not nowatch and threads and not returnUnfinished and any([thread.is_alive() for thread in threads]) and sys.stdout.isatty() and os.get_terminal_size() and os.get_terminal_size().columns > 10:
2269
- curses.wrapper(curses_print, hosts, threads, min_char_len = curses_min_char_len, min_line_len = curses_min_line_len, single_window = single_window)
2276
+ if __curses_available and not nowatch and threads and not returnUnfinished and sys.stdout.isatty() and os.get_terminal_size() and os.get_terminal_size().columns > 10:
2277
+ total_sleeped = 0
2278
+ while any([host.returncode is None for host in hosts]):
2279
+ time.sleep(sleep_interval) # avoid busy-waiting
2280
+ total_sleeped += sleep_interval
2281
+ if sleep_interval < 0.001:
2282
+ sleep_interval *= 2
2283
+ elif sleep_interval < 0.01:
2284
+ sleep_interval *= 1.1
2285
+ if total_sleeped > 0.1:
2286
+ break
2287
+ if any([host.returncode is None for host in hosts]):
2288
+ curses.wrapper(curses_print, hosts, threads, min_char_len = curses_min_char_len, min_line_len = curses_min_line_len, single_window = single_window)
2270
2289
  if not returnUnfinished:
2271
2290
  # wait until all hosts have a return code
2272
2291
  while any([host.returncode is None for host in hosts]):
2273
- time.sleep(0.01)
2292
+ time.sleep(sleep_interval) # avoid busy-waiting
2293
+ if sleep_interval < 0.01:
2294
+ sleep_interval *= 1.1
2274
2295
  for thread in threads:
2275
2296
  thread.join(timeout=3)
2276
2297
  # update the unavailable hosts and global unavailable hosts
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes