def main(): shortflags = "dh" longflags = ['debug', 'help'] try: opts, args = getopt.getopt(sys.argv[1:], shortflags, longflags) except getopt.GetoptError: printUsageAndExit() debug = False for o, a in opts: if o in ("-d", "--debug"): debug = True if o in ("-h", "--help"): printUsageAndExit() if (len(args) < 3): printUsageAndExit() sizeOfMessage = int(args[0]) debugprint("size of message: " + str(sizeOfMessage), debug) numMessages = int(args[1]) debugprint("num messages: " + str(numMessages), debug) delayBetweenMessages = int(args[2]) debugprint("delay between messages: " + str(delayBetweenMessages), debug) # instantiate a NCStressSupplier object myTestSupplier = NCStressSupplier(debug, sizeOfMessage, numMessages, delayBetweenMessages) # send the messages, per the command line arguments provided myTestSupplier.sendMessages()
def main(): shortflags = "dh" longflags = ['debug','help'] try: opts, args = getopt.getopt(sys.argv[1:], shortflags, longflags) except getopt.GetoptError: printUsageAndExit() debug = False for o, a in opts: if o in ("-d", "--debug"): debug = True if o in ("-h", "--help"): printUsageAndExit() if(len(args) < 3): printUsageAndExit() sizeOfMessage = int(args[0]) debugprint("size of message: " + str(sizeOfMessage), debug) numMessages = int(args[1]) debugprint("num messages: " + str(numMessages), debug) delayBetweenMessages = int(args[2]) debugprint("delay between messages: " + str(delayBetweenMessages), debug) # instantiate a NCStressSupplier object myTestSupplier = NCStressSupplier(debug, sizeOfMessage, numMessages, delayBetweenMessages) # send the messages, per the command line arguments provided myTestSupplier.sendMessages()
for pid in pids: debugprint( "monitoring remote consumer: " + str(count) + " with pid: " + pid.strip(), debug) remoteConsumerSshCmd = 'ssh ' + userName + '@' + remoteHost + ' sar -x ' + pid.strip() + ' 1 9999 >& ./tmp/consumerCpu'\ + str(count) + '-remote.orig.log' remoteConsumerSarProcess = popen2.Popen3(remoteConsumerSshCmd) remoteConsumerMonitors.append(remoteConsumerSarProcess) remoteConsumerSshCmd = 'ssh ' + userName + '@' + remoteHost + ' remoteMonitorProcess ' + pid.strip() + ' 1 >& ./tmp/consumerMemory'\ + str(count) + '-remote.orig.log' remoteConsumerMemoryProcess = popen2.Popen3(remoteConsumerSshCmd) remoteConsumerMemoryMonitors.append(remoteConsumerMemoryProcess) count += 1 # send messages myTestSupplier = NCStressSupplier(debug, sizeOfMsg, numMsgs, delayBetweenMsgs) debugprint("sending messages", debug) myTestSupplier.sendMessages() # wait for local things to complete fileStrings = [] for i in range(0, numLocalConsumers): debugprint("waiting for local consumer" + str(i) + " to complete", debug) fileStrings.append("./tmp/consumer" + str(i) + "-local.out") count = 0 allReceived = False while (count < timeToWait and allReceived is False): allReceived = verifyMessagesReceived(fileStrings, numMsgs, debug) sleep(2.0)
count = 0 for pid in pids: debugprint("monitoring remote consumer: " + str(count) + " with pid: " + pid.strip(), debug) remoteConsumerSshCmd = 'ssh ' + userName + '@' + remoteHost + ' sar -x ' + pid.strip() + ' 1 9999 >& ./tmp/consumerCpu'\ + str(count) + '-remote.orig.log' remoteConsumerSarProcess = popen2.Popen3(remoteConsumerSshCmd) remoteConsumerMonitors.append(remoteConsumerSarProcess) remoteConsumerSshCmd = 'ssh ' + userName + '@' + remoteHost + ' remoteMonitorProcess ' + pid.strip() + ' 1 >& ./tmp/consumerMemory'\ + str(count) + '-remote.orig.log' remoteConsumerMemoryProcess = popen2.Popen3(remoteConsumerSshCmd) remoteConsumerMemoryMonitors.append(remoteConsumerMemoryProcess) count += 1 # send messages myTestSupplier = NCStressSupplier(debug, sizeOfMsg, numMsgs, delayBetweenMsgs) debugprint("sending messages", debug) myTestSupplier.sendMessages() # wait for local things to complete fileStrings = [] for i in range(0, numLocalConsumers): debugprint("waiting for local consumer" + str(i) + " to complete", debug) fileStrings.append("./tmp/consumer" + str(i) + "-local.out") count = 0 allReceived = False while(count < timeToWait and allReceived is False): allReceived = verifyMessagesReceived(fileStrings, numMsgs, debug) sleep(2.0) count += 2