Update example app.

This commit is contained in:
Tom Wilkie
2015-12-17 13:54:42 +00:00
parent 1ef6006c55
commit 6dc65e2481
3 changed files with 22 additions and 4 deletions

2
.gitignore vendored
View File

@@ -50,8 +50,6 @@ experimental/genreport/genreport
experimental/graphviz/graphviz
experimental/oneshot/oneshot
experimental/_integration/_integration
experimental/tracer/main/main
experimental/tracer/tracer.tar
*sublime-project
*sublime-workspace
*npm-debug.log

View File

@@ -48,12 +48,26 @@ def ignore_error(f):
logging.error("Error executing function", exc_info=sys.exc_info())
return "Error"
@app.route('/')
# this root is for the tracing demo
@app.route('/hello')
def hello():
qotd_msg = do_qotd()
qotd_msg = do_echo(qotd_msg)
return qotd_msg
# this is for normal demos
@app.route('/')
def root():
counter_future = pool.submit(do_redis)
search_future = pool.submit(do_search)
qotd_future = pool.submit(do_qotd)
echo_future = pool.submit(lambda: do_echo("foo"))
result = 'Hello World! I have been seen %s times.' % ignore_error(counter_future.result)
result += ignore_error(search_future.result)
result += ignore_error(qotd_future.result)
result += ignore_error(echo_future.result)
return result
if __name__ == "__main__":
logging.basicConfig(format='%(asctime)s %(levelname)s %(filename)s:%(lineno)d - %(message)s', level=logging.INFO)
WSGIRequestHandler.protocol_version = "HTTP/1.1"

View File

@@ -19,6 +19,12 @@ start_container() {
done
}
start_container 1 elasticsearch elasticsearch
start_container 2 tomwilkie/searchapp searchapp
start_container 1 redis redis
start_container 1 tomwilkie/qotd qotd
start_container 1 tomwilkie/app app
start_container 1 tomwilkie/echo echo
start_container 2 tomwilkie/app app
start_container 2 tomwilkie/frontend frontend --add-host=dns.weave.local:$(weave docker-bridge-ip)
start_container 1 tomwilkie/client client