You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by hu...@apache.org on 2018/08/24 07:50:07 UTC
[incubator-heron] branch master updated: Yaoli/fix stateful test
(#3004)
This is an automated email from the ASF dual-hosted git repository.
huijun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
The following commit(s) were added to refs/heads/master by this push:
new 03ba3f6 Yaoli/fix stateful test (#3004)
03ba3f6 is described below
commit 03ba3f6d4a8024b430ad25ecdea9b0cdd3735b34
Author: Yao Li <cl...@gmail.com>
AuthorDate: Fri Aug 24 00:50:03 2018 -0700
Yaoli/fix stateful test (#3004)
* fix duplicated state info at http server
* deleted unused import
---
integration_test/src/python/http_server/main.py | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/integration_test/src/python/http_server/main.py b/integration_test/src/python/http_server/main.py
index c4bfde4..9a7dcd1 100644
--- a/integration_test/src/python/http_server/main.py
+++ b/integration_test/src/python/http_server/main.py
@@ -106,7 +106,12 @@ class StateResultHandler(tornado.web.RequestHandler):
data = tornado.escape.json_decode(self.request.body)
if key:
if key in self.result_map:
- self.result_map[key].append(data)
+ # fix the duplicate record issue
+ for comp in self.result_map[key]:
+ if comp.keys()[0] == data.keys()[0]:
+ break
+ else:
+ self.result_map[key].append(data)
else:
self.result_map[key] = [data]
self.write("Results written successfully: topology " + key + ' instance ' + data.keys()[0])
@@ -128,11 +133,11 @@ def main():
# for instance states in stateful processing
state_result_map = {}
application = tornado.web.Application([
- (r"/", MainHandler),
- (r"^/results/([a-zA-Z0-9_-]+$)", FileHandler),
- (r"^/state", MemoryMapGetAllHandler, dict(state_map=state_map)),
- (r"^/state/([a-zA-Z0-9_-]+$)", MemoryMapHandler, dict(state_map=state_map)),
- (r"^/stateResults/([a-zA-Z0-9_-]+$)", StateResultHandler, dict(result_map=state_result_map)),
+ (r"/", MainHandler),
+ (r"^/results/([a-zA-Z0-9_-]+$)", FileHandler),
+ (r"^/state", MemoryMapGetAllHandler, dict(state_map=state_map)),
+ (r"^/state/([a-zA-Z0-9_-]+$)", MemoryMapHandler, dict(state_map=state_map)),
+ (r"^/stateResults/([a-zA-Z0-9_-]+$)", StateResultHandler, dict(result_map=state_result_map)),
])
if len(sys.argv) == 1: