azagrebin commented on a change in pull request #9175: [FLINK-12038] [test] fix
YARNITCase random fail
URL: https://github.com/apache/flink/pull/9175#discussion_r306933213
##########
File path:
flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
##########
@@ -573,6 +576,23 @@ public static int getRunningContainers() {
return count;
}
+ void waitUntilApplicationFinished(ApplicationId applicationId, Duration
timeout) throws Exception {
+ Deadline deadline = Deadline.now().plus(timeout);
+ while (true) {
+ YarnApplicationState state =
yarnClient.getApplicationReport(applicationId).getYarnApplicationState();
+ if (state == YarnApplicationState.FINISHED) {
+ break;
+ } else if (state == YarnApplicationState.FAILED ||
state == YarnApplicationState.KILLED) {
+ Assert.fail("Application became FAILED or
KILLED while expecting FINISHED");
+ } else {
+ sleep(sleepIntervalInMS);
+ }
+ if (deadline.isOverdue()) {
+ Assert.fail("Application didn't finish before
timeout");
Review comment:
I think we should move the app killing from the finally block of
`YARNITCase. waitUntilApplicationFinished` to this timeout case, right before
`Assert.fail("Application didn't finish before timeout");`. As we need killing
only if the app hangs but we do not need if it finished successfully.
----------------------------------------------------------------
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]
With regards,
Apache Git Services