timoninmaxim commented on a change in pull request #8232:
URL: https://github.com/apache/ignite/pull/8232#discussion_r487815072
##########
File path: modules/ducktests/tests/ignitetest/services/ignite_app.py
##########
@@ -38,33 +41,54 @@ def __init__(self, context, config, java_class_name,
params="", timeout_sec=60,
self.servicejava_class_name = servicejava_class_name
self.java_class_name = java_class_name
self.timeout_sec = timeout_sec
- self.stop_timeout_sec = 10
+ self.params = params
def start(self):
super().start()
self.logger.info("Waiting for Ignite aware Application (%s) to
start..." % self.java_class_name)
self.await_event("Topology snapshot", self.timeout_sec,
from_the_beginning=True)
-
self.await_event("IGNITE_APPLICATION_INITIALIZED\\|IGNITE_APPLICATION_BROKEN",
self.timeout_sec,
- from_the_beginning=True)
- try:
- self.await_event("IGNITE_APPLICATION_INITIALIZED", 1,
from_the_beginning=True)
- except Exception:
- raise Exception("Java application execution failed. %s" %
self.extract_result("ERROR")) from None
+ self.__check_status("IGNITE_APPLICATION_INITIALIZED",
timeout=self.timeout_sec)
- # pylint: disable=W0221
- def stop_node(self, node, clean_shutdown=True, timeout_sec=20):
- self.logger.info("%s Stopping node %s" % (self.__class__.__name__,
str(node.account)))
- node.account.kill_java_processes(self.servicejava_class_name,
clean_shutdown=clean_shutdown, allow_fail=True)
+ def stop_async(self, clean_shutdown=True):
+ """
+ Stops node in async way.
+ """
+ self.logger.info("%s Stopping node %s" % (self.__class__.__name__,
str(self.nodes[0].account)))
+ self.nodes[0].account.kill_java_processes(self.servicejava_class_name,
clean_shutdown=clean_shutdown,
+ allow_fail=True)
- stopped = self.wait_node(node, timeout_sec=self.stop_timeout_sec)
+ def await_stopped(self, timeout_sec=10):
+ """
+ Awaits node stop finish.
+ """
+ stopped = self.wait_node(self.nodes[0], timeout_sec=timeout_sec)
assert stopped, "Node %s: did not stop within the specified timeout of
%s seconds" % \
- (str(node.account), str(self.stop_timeout_sec))
+ (str(self.nodes[0].account), str(timeout_sec))
-
self.await_event("IGNITE_APPLICATION_FINISHED\\|IGNITE_APPLICATION_BROKEN",
from_the_beginning=True,
- timeout_sec=timeout_sec)
+ self.__check_status("IGNITE_APPLICATION_FINISHED", timeout=timeout_sec)
+
+ # pylint: disable=W0221
+ def stop_node(self, node, clean_shutdown=True, timeout_sec=10):
+ assert node == self.nodes[0]
+ self.stop_async(clean_shutdown)
+ self.await_stopped(timeout_sec)
+
+ def __check_status(self, desired, timeout=1):
+ self.await_event("%s\\|IGNITE_APPLICATION_BROKEN" % desired, timeout,
from_the_beginning=True)
+
+ try:
+ self.await_event("IGNITE_APPLICATION_BROKEN", 1,
from_the_beginning=True)
Review comment:
I mean there should be return immediately. As I see this line just
checks that previous wait finishes due to error.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]