zuston commented on a change in pull request #18220:
URL: https://github.com/apache/flink/pull/18220#discussion_r800180651
##########
File path:
flink-yarn/src/main/java/org/apache/flink/yarn/YarnClusterDescriptor.java
##########
@@ -1195,53 +1189,78 @@ private ApplicationReport startAppMaster(
yarnClient.submitApplication(appContext);
LOG.info("Waiting for the cluster to be allocated");
+
+ YarnClientWrapper yarnClientWrapper = YarnClientWrapper.of(yarnClient,
false);
+
+ try {
+ waitTillTargetState(
+ yarnClientWrapper,
+ appId,
+ YarnApplicationState.ACCEPTED,
+ YarnApplicationState.RUNNING);
+ } catch (IOException e) {
+ throw new YarnDeploymentException("Failed to deploy the cluster.",
e);
+ }
+
+ // since deployment was successful, remove the hook
+ ShutdownHookUtil.removeShutdownHook(deploymentFailureHook,
getClass().getSimpleName(), LOG);
+
+ return ApplicationReportProviderImpl.of(
+ YarnClientRetrieverImpl.from(yarnClientWrapper,
yarnConfiguration), applicationId);
+ }
+
+ public static ApplicationReport waitTillTargetState(
+ YarnClientWrapper yarnClient, ApplicationId appId,
YarnApplicationState... targetStates)
Review comment:
Maybe `YarnClientWrapper` will be better, we hope that client could be
managed by it, like the method of `close`.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]