spawn(printer, "[echo] Echoing \"Hi there\"", echo.echo, "Hi there") try: print "Testing a remote exception...", echo.error() print "FAIL, no remote exception!" except RemoteRPCError, e: print "OK, got an expected remote exception:" #print e.ename print e.evalue print e.traceback try: print "Testing a timeout...", echo.call('sleep', args=[2.3], timeout=1.1) print "FAIL, timeout didn't work!" except RPCTimeoutError, e: print "OK, got an expected timeout:" print repr(e) print print 'Ignoring result... ', echo.call('error', ignore=True) print 'OK\n' spawn(printer, "[echo] Sleeping for 2 seconds...", echo.sleep, 2.0) math = GreenRPCClient(green_env='eventlet') # By connecting to two instances, requests are load balanced. math.connect('tcp://127.0.0.1:5556')
spawn(printer, "[echo] Echoing \"Hi there\"", echo.echo, "Hi there") try: print "Testing a remote exception...", echo.error() print "FAIL, no remote exception!" except RemoteRPCError, e: print "OK, got an expected remote exception:" #print e.ename print e.evalue print e.traceback try: print "Testing a timeout...", echo.call('sleep', args=[2.3], timeout=1.1) print "FAIL, timeout didn't work!" except RPCTimeoutError, e: print "OK, got an expected timeout:" print repr(e) print print 'Ignoring result... ', echo.call('error', ignore=True) print 'OK\n' spawn(printer, "[echo] Sleeping for 2 seconds...", echo.sleep, 2.0) math = GreenRPCClient(green_env='gevent') # By connecting to two instances, requests are load balanced. math.connect('tcp://127.0.0.1:5556')