use of com.tencent.angel.master.app.App in project angel by Tencent.
the class AngelAppBlock method render.
@Override
protected void render(Block html) {
set(TITLE, join("Angel Application", amContext.getApplicationId()));
App app = amContext.getApp();
long elaspedTs = 0;
if (app.getLaunchTime() != 0 && app.getFinishTime() != 0) {
elaspedTs = app.getFinishTime() - app.getLaunchTime();
} else if (app.getLaunchTime() != 0 && app.getFinishTime() == 0) {
elaspedTs = System.currentTimeMillis() - app.getLaunchTime();
}
info("Job Overview")._("Job Name:", amContext.getApplicationName())._("State:", app.getExternAppState().toString())._("Started:", new Date(app.getLaunchTime()))._("Elapsed:", StringUtils.formatTime(elaspedTs))._("Environment:", "nomeaning" == null ? "#" : "angel/EnvironmentPage", "Runtime Information And Properties")._("Task Progress:", "nomeaning" == null ? "#" : "angel/ProgressPage", "progress")._("Master Threaddump:", "nomeaning" == null ? "#" : "angel/ExecutorsPage", "threaddump");
DIV<Hamlet> div = html._(InfoBlock.class).div(_INFO_WRAP);
TABLE<DIV<Hamlet>> table = div.table("#job");
table.tr().th(_TH, "module").th(_TH, "new").th(_TH, "running").th(_TH, "failed").th(_TH, "killed").th(_TH, "success")._();
int newGroupNum = 0;
int runningGroupNum = 0;
int failedGroupNum = 0;
int killedGroupNum = 0;
int successGroupNum = 0;
int newPSNum = 0;
int runningPSNum = 0;
int failedPSNum = 0;
int killedPSNum = 0;
int successPSNum = 0;
LOG.info("before compute worker state items");
if (amContext.getWorkerManager() != null) {
for (AMWorkerGroup group : amContext.getWorkerManager().getWorkerGroupMap().values()) {
switch(group.getState()) {
case NEW:
case INITED:
newGroupNum += 1;
break;
case RUNNING:
runningGroupNum += 1;
break;
case KILLED:
killedGroupNum += 1;
break;
case FAILED:
failedGroupNum += 1;
break;
case SUCCESS:
successGroupNum += 1;
break;
default:
break;
}
}
}
for (AMParameterServer ps : amContext.getParameterServerManager().getParameterServerMap().values()) {
for (PSAttempt psAttemp : ps.getPSAttempts().values()) {
switch(psAttemp.getInternalState()) {
case NEW:
case SCHEDULED:
case LAUNCHED:
newPSNum += 1;
break;
case RUNNING:
case COMMITTING:
runningPSNum += 1;
break;
case KILLED:
killedPSNum += 1;
break;
case FAILED:
failedPSNum += 1;
break;
case SUCCESS:
successPSNum += 1;
break;
default:
break;
}
}
}
table.tr().td("workergroups").td().a(url("angel/workerGroupsPage", "NEW"), String.valueOf(newGroupNum))._().td().a(url("angel/workerGroupsPage", "RUNNING"), String.valueOf(runningGroupNum))._().td().a(url("angel/workerGroupsPage", "FAILED"), String.valueOf(failedGroupNum))._().td().a(url("angel/workerGroupsPage", "KILLED"), String.valueOf(killedGroupNum))._().td().a(url("angel/workerGroupsPage", "SUCCESS"), String.valueOf(successGroupNum))._()._().tr().td("parameterservers").td().a(url("angel/parameterServersPage", "NEW"), String.valueOf(newPSNum))._().td().a(url("angel/parameterServersPage", "RUNNING"), String.valueOf(runningPSNum))._().td().a(url("angel/parameterServersPage", "FAILED"), String.valueOf(failedPSNum))._().td().a(url("angel/parameterServersPage", "KILLED"), String.valueOf(killedPSNum))._().td().a(url("angel/parameterServersPage", "SUCCESS"), String.valueOf(successPSNum))._()._();
table._();
div._();
}
use of com.tencent.angel.master.app.App in project angel by Tencent.
the class YarnContainerAllocator method doUnregistration.
@VisibleForTesting
protected void doUnregistration() throws YarnException, IOException, InterruptedException {
FinalApplicationStatus finishState = FinalApplicationStatus.UNDEFINED;
App app = context.getApp();
// get application finish state
AppState appState = app.getInternalState();
if (appState == AppState.SUCCEEDED) {
finishState = FinalApplicationStatus.SUCCEEDED;
} else if (appState == AppState.KILLED) {
finishState = FinalApplicationStatus.KILLED;
} else if (appState == AppState.FAILED) {
finishState = FinalApplicationStatus.FAILED;
}
// build application diagnostics
StringBuilder sb = new StringBuilder();
for (String s : app.getDiagnostics()) {
sb.append(s).append("\n");
}
LOG.info("Setting job diagnostics to " + sb.toString());
// TODO:add a job history for angel
String historyUrl = "angel does not have history url now";
// build unregister request
FinishApplicationMasterRequest request = FinishApplicationMasterRequest.newInstance(finishState, sb.toString(), historyUrl);
// send unregister request to rm
while (true) {
try {
FinishApplicationMasterResponse response = amRmProtocol.finishApplicationMaster(request);
if (response.getIsUnregistered()) {
break;
}
} catch (Exception x) {
LOG.error("unregister failed ", x);
break;
}
LOG.info("Waiting for application to be successfully unregistered.");
Thread.sleep(rmPollInterval);
}
successfullyUnregistered.set(true);
}
Aggregations