in odps-sdk/odps-sdk-graph/src/main/java/com/aliyun/odps/graph/job/NetworkRunningJob.java [134:211]
protected void updateStatus() {
int maxRetryTimes = 3;
int retry_times = 0;
while (true) {
try {
Status instanceStatus = instance.getStatus();
if (instanceStatus == Status.RUNNING
|| instanceStatus == Status.SUSPENDED) {
state = JobStatus.RUNNING;
} else if (instanceStatus == Status.TERMINATED) {
TaskStatus taskStatus = instance.getTaskStatus().get(task.getName());
switch (taskStatus.getStatus()) {
case WAITING:
case RUNNING:
case FAILED:
state = JobStatus.FAILED;
break;
case SUCCESS:
state = JobStatus.SUCCEEDED;
break;
case CANCELLED:
state = JobStatus.KILLED;
break;
default:
throw new OdpsException("Got Unknown task status: "
+ taskStatus.getStatus());
}
} else {
throw new OdpsException("Got unknown instance status '"
+ instanceStatus + "'");
}
// try to print process information
if (needPrintProcess() || isFinished()) {
printProgress(instanceStatus);
}
break; // success
} catch (Exception ex) {
retry_times++;
if (retry_times > maxRetryTimes) {
throw new RuntimeException(ex);
}
System.err.println("Update status failed, retry counter: "
+ retry_times + ", Exception: " + ex.getMessage());
try {
Thread.sleep(30 * 1000);
} catch (InterruptedException e) {
}
}
}
if (isFinished()) {
maxRetryTimes = 3;
retry_times = 0;
while (true) {
try {
printSummaryAndCollectCounters();
printResult();
break; // success
} catch (Exception ex) {
retry_times++;
if (retry_times > maxRetryTimes) {
throw new RuntimeException(ex);
}
System.err.println("Get summary or result failed, retry counter: "
+ retry_times + ", Exception: " + ex.getMessage());
try {
Thread.sleep(30 * 1000);
} catch (InterruptedException e) {
}
}
}
}
}