@@ -82,9 +82,9 @@ def strcmd(cmd):
8282 return reduce (lambda x , y : x + ' ' + y , map (lambda x : x .find (' ' ) > 0 and "'" + x + "'" or x , cmd ))
8383
8484
85- def gpssh (cmd , call_verbose = True ):
85+ def gpssh (cmd , verbose ):
8686 c = ['%s/bin/gpssh' % GPHOME ]
87- if GV . opt [ '-V' ] and call_verbose :
87+ if verbose :
8888 c .append ('-v' )
8989 if GV .opt ['-f' ]:
9090 c .append ('-f' )
@@ -326,13 +326,13 @@ def runTeardown():
326326 for d in GV .opt ['-d' ]:
327327 dirs = '%s %s/gpcheckperf_$USER' % (dirs , d )
328328 try :
329- gpssh ('rm -rf ' + dirs )
329+ gpssh ('rm -rf ' + dirs , GV . opt [ '-V' ] )
330330 except :
331331 pass
332332
333333 try :
334334 if GV .opt ['--net' ]:
335- gpssh (killall (GV .opt ['--netserver' ]))
335+ gpssh (killall (GV .opt ['--netserver' ]), GV . opt [ '-V' ] )
336336 except :
337337 pass
338338
@@ -349,7 +349,7 @@ def runSetup():
349349 # Verify python3 is accessible
350350 if GV .opt ['-v' ]:
351351 print ('[Info] verify python3 interpreter exists' )
352- (ok , out ) = gpssh ('python3 -c print' )
352+ (ok , out ) = gpssh ('python3 -c print' , GV . opt [ '-V' ] )
353353 if not ok :
354354 if not GV .opt ['-v' ]:
355355 print (out )
@@ -364,7 +364,7 @@ def runSetup():
364364 dirs = '%s %s/gpcheckperf_$USER' % (dirs , d )
365365
366366 cmd = 'rm -rf %s ; mkdir -p %s' % (dirs , dirs )
367- (ok , out ) = gpssh (cmd )
367+ (ok , out ) = gpssh (cmd , GV . opt [ '-V' ] )
368368 if not ok :
369369 print ('failed gpssh: %s' % out )
370370 sys .exit ("[Error] unable to make gpcheckperf directory. \n "
@@ -402,7 +402,7 @@ def copyExecOver(fname):
402402 sys .exit ('[Error] command failed: gpsync %s =:%s with output: %s' % (path , target , out ))
403403
404404 # chmod +x file
405- (ok , out ) = gpssh ('chmod a+rx %s' % target )
405+ (ok , out ) = gpssh ('chmod a+rx %s' % target , GV . opt [ '-V' ] )
406406 if not ok :
407407 sys .exit ('[Error] command failed: chmod a+rx %s with output: %s' % (target , out ))
408408
@@ -458,7 +458,7 @@ def runDiskWriteTest(multidd):
458458 cmd = cmd + (' -B %d' % GV .opt ['-B' ])
459459 if GV .opt ['-S' ]:
460460 cmd = cmd + (' -S %d' % GV .opt ['-S' ])
461- (ok , out ) = gpssh (cmd )
461+ (ok , out ) = gpssh (cmd , GV . opt [ '-V' ] )
462462 if not ok :
463463 sys .exit ('[Error] command failed: %s with output: %s' % (cmd , out ))
464464 return parseMultiDDResult (out )
@@ -477,7 +477,7 @@ def runDiskReadTest(multidd):
477477 cmd = cmd + (' -B %d' % GV .opt ['-B' ])
478478 if GV .opt ['-S' ]:
479479 cmd = cmd + (' -S %d' % GV .opt ['-S' ])
480- (ok , out ) = gpssh (cmd )
480+ (ok , out ) = gpssh (cmd , GV . opt [ '-V' ] )
481481 if not ok :
482482 sys .exit ('[Error] command failed: %s with output: %s' % (cmd , out ))
483483 return parseMultiDDResult (out )
@@ -490,7 +490,7 @@ def runStreamTest():
490490 print ('--------------------' )
491491
492492 cmd = copyExecOver ('stream' )
493- (ok , out ) = gpssh (cmd )
493+ (ok , out ) = gpssh (cmd , GV . opt [ '-V' ] )
494494 if not ok :
495495 sys .exit ('[Error] command failed: %s with output: %s' % (cmd , out ))
496496 out = io .StringIO (out )
@@ -512,9 +512,9 @@ def startNetServer():
512512 for i in range (5 ):
513513 if i > 0 :
514514 print ('[Warning] retrying with port %d' % port )
515- (ok , out ) = gpssh (killall (GV .opt ['--netserver' ]))
515+ (ok , out ) = gpssh (killall (GV .opt ['--netserver' ]), GV . opt [ '-V' ] )
516516
517- (ok , out ) = gpssh ('%s -p %d > /dev/null 2>&1' % (rmtPath , port ))
517+ (ok , out ) = gpssh ('%s -p %d > /dev/null 2>&1' % (rmtPath , port ), GV . opt [ '-V' ] )
518518 if ok :
519519 return port
520520
@@ -745,8 +745,15 @@ def get_host_map(hostlist):
745745 seglist = dict () # segment list
746746 uniqhosts = dict () # unique host list
747747
748- # get list of hostnames
749- # disabling verbose mode for gpssh as it is adding extra lines of output
748+ '''
749+ Get hostnames using non-verbose mode since verbose output makes parsing difficult with extra lines as show:
750+ Using delaybeforesend 0.05 and prompt_validation_timeout 1.0
751+ [Reset ...]
752+ [INFO] login sdw2
753+ [sdw2] sdw2
754+ [INFO] completed successfully
755+ [Cleanup...]
756+ '''
750757 rc , out = gpssh ('hostname' , False )
751758
752759 if not rc :
@@ -760,9 +767,6 @@ def get_host_map(hostlist):
760767 # get unique hostname list
761768 for line in out .splitlines ():
762769 seg , host = line .translate (str .maketrans ('' ,'' ,'[]' )).split ()
763- # removing \r and b coming in the output of the command in hostname
764- host = host .replace ('\\ r\' ' , '' )
765- host = host .replace ('b\' ' , '' )
766770 uniqhosts [host ] = seg
767771
768772 # get list of segments associated with each host (can't use gpssh since it de-dupes hosts)
@@ -771,7 +775,7 @@ def get_host_map(hostlist):
771775
772776 proc = None
773777 try :
774- if GV .opt ['-v' ] or GV . opt [ '-V' ] :
778+ if GV .opt ['-v' ]:
775779 print ('[Info]' , strcmd (cmd ))
776780 proc = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
777781 out = proc .stdout .read (- 1 )
@@ -824,8 +828,6 @@ def runNetPerfTestMatrix():
824828
825829
826830def printMatrixResult (result , seglist ):
827- if not result :
828- return
829831 print ('Full matrix netperf bandwidth test' )
830832
831833 # sum up Rx/Tx rate for each host
@@ -882,8 +884,6 @@ def printMatrixResult(result, seglist):
882884
883885
884886def printNetResult (result ):
885- if not result :
886- return
887887 print ('Netperf bisection bandwidth test' )
888888 for h in result :
889889 print ('%s -> %s = %f' % (h [0 ], h [1 ], h [6 ]))
@@ -915,8 +915,6 @@ def printNetResult(result):
915915
916916
917917def printResult (title , result ):
918- if not result :
919- return
920918 totTime = 0
921919 totBytes = 0
922920 totMBPS = 0
0 commit comments