multiCMD 1.23__tar.gz → 1.24__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: multiCMD
3
- Version: 1.23
3
+ Version: 1.24
4
4
  Summary: Run commands simultaneously
5
5
  Home-page: https://github.com/yufei-pan/multiCMD
6
6
  Author: Yufei Pan
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: multiCMD
3
- Version: 1.23
3
+ Version: 1.24
4
4
  Summary: Run commands simultaneously
5
5
  Home-page: https://github.com/yufei-pan/multiCMD
6
6
  Author: Yufei Pan
@@ -18,7 +18,7 @@ import re
18
18
  import itertools
19
19
  import signal
20
20
 
21
- version = '1.23'
21
+ version = '1.24'
22
22
  __version__ = version
23
23
 
24
24
  __running_threads = []
@@ -264,6 +264,31 @@ def __run_command(task,sem, timeout=60, quiet=False,dry_run=False,with_stdErr=Fa
264
264
  else:
265
265
  return task.stdout
266
266
 
267
+ def ping(hosts,timeout=1,max_threads=0,quiet=True,dry_run=False,with_stdErr=False,
268
+ return_code_only=True,return_object=False,wait_for_return=True):
269
+ '''
270
+ Ping multiple hosts
271
+
272
+ @params:
273
+ hosts: The hosts to ping
274
+ timeout: The timeout for the command
275
+ max_threads: The maximum number of threads to use
276
+ quiet: Whether to suppress output
277
+ dry_run: Whether to simulate running the command
278
+ with_stdErr: Whether to append the standard error output to the standard output
279
+ return_code_only: Whether to return only the return code
280
+ return_object: Whether to return the Task object
281
+ wait_for_return: Whether to wait for the return of the command
282
+
283
+ @returns:
284
+ None | int | list[str] | Task: The output of the command
285
+ '''
286
+ commands = [f'ping -c 1 {host}' for host in hosts]
287
+ return run_commands(commands, timeout=timeout, max_threads=max_threads, quiet=quiet,
288
+ dry_run=dry_run, with_stdErr=with_stdErr, return_code_only=return_code_only,
289
+ return_object=return_object,wait_for_return=wait_for_return)
290
+
291
+
267
292
  def run_command(command, timeout=0,max_threads=1,quiet=False,dry_run=False,with_stdErr=False,
268
293
  return_code_only=False,return_object=False,wait_for_return=True):
269
294
  '''
File without changes
File without changes
File without changes