YARN-9112. [Submarine] Support polling applicationId when it's not ready in cluster. (Zhankun Tang via wangda)
Change-Id: I73d73f3d631b28fb9866faa56571839b13824a97
(cherry picked from commit 9fba6cc247
)
This commit is contained in:
parent
ef0f835537
commit
29e4e5f62c
|
@ -867,9 +867,25 @@ public class YarnServiceJobSubmitter implements JobSubmitter {
|
||||||
|
|
||||||
String appStatus=appAdminClient.getStatusString(serviceSpec.getName());
|
String appStatus=appAdminClient.getStatusString(serviceSpec.getName());
|
||||||
Service app = ServiceApiUtil.jsonSerDeser.fromJson(appStatus);
|
Service app = ServiceApiUtil.jsonSerDeser.fromJson(appStatus);
|
||||||
|
|
||||||
|
// Retry multiple times if applicationId is null
|
||||||
|
int maxRetryTimes = 30;
|
||||||
|
int count = 0;
|
||||||
|
while (app.getId() == null && count < maxRetryTimes) {
|
||||||
|
LOG.info("Waiting for application Id. AppStatusString=\n {}", appStatus);
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new IOException(e);
|
||||||
|
}
|
||||||
|
appStatus = appAdminClient.getStatusString(serviceSpec.getName());
|
||||||
|
app = ServiceApiUtil.jsonSerDeser.fromJson(appStatus);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
// Retry timeout
|
||||||
if (app.getId() == null) {
|
if (app.getId() == null) {
|
||||||
throw new YarnException("Can't get application id for Service " +
|
throw new YarnException(
|
||||||
serviceSpec.getName());
|
"Can't get application id for Service " + serviceSpec.getName());
|
||||||
}
|
}
|
||||||
ApplicationId appid = ApplicationId.fromString(app.getId());
|
ApplicationId appid = ApplicationId.fromString(app.getId());
|
||||||
appAdminClient.stop();
|
appAdminClient.stop();
|
||||||
|
|
Loading…
Reference in New Issue