def __init__(self): self.env = os.environ try: if (not self.env['JMETER_HOME']): if (os.access('/usr/bin/jmeter')): self.env['JMETER_HOME'] = '/usr' else: dlt.log('Unable to locate jmeter. Please install jmeter or set JMETER_HOME to correct location.', dlt.LOG_ERROR) except Exception, e: print e
import dlt def main(args): # Initialize the DLT tester tester = dlt.DrupalLoadTest() # Get config parser config = tester.config.get() context = zmq.Context() socket = context.socket(zmq.REP) socket.bind("tcp://*:" + config['Server']['port']) while True: # Wait for next request from client message = socket.recv() print "Received request: ", message # Do some 'work' time.sleep (1) # Send reply back to client socket.send("World") if __name__ == "__main__": try: main(sys.argv[1:]) except KeyboardInterrupt: dlt.log("Interrupted by input. Exiting.")