in odps-console-public/src/main/java/com/aliyun/openservices/odps/console/pub/TopInstanceCommand.java [156:206]
private String getQueueingMessage(Instance.InstanceQueueingInfo info) {
Long cpu = info.getProperty("cpuUsage", Long.class);
Long mem = info.getProperty("memUsage", Long.class);
String runtimeUsage = "";
if (cpu != null && mem != null) {
runtimeUsage = String.format("%d/%d", cpu, mem);
}
cpu = info.getProperty("totalCpuUsage", Long.class);
mem = info.getProperty("totalMemUsage", Long.class);
String totalUsage = "";
if (cpu != null && mem != null) {
totalUsage = String.format("%d/%d", cpu, mem);
}
String queuePos = "";
Long pos = info.getProperty("waitPos", Long.class);
Long length = info.getProperty("queueLength", Long.class);
if (pos != null && length != null) {
queuePos = String.format("%d/%d", pos, length);
}
String status = info.getStatus().toString();
JsonObject subStatus = info.getProperty("subStatus", JsonObject.class);
if (subStatus != null && !StringUtils.isNullOrEmpty(subStatus.get("description").getAsString())) {
status = String.format("%s(%s)", status, subStatus.get("description").getAsString());
}
String type = info.getTaskType() == null ? "" : info.getTaskType();
Double progress = info.getProgress();
String progressStr = "";
if (progress != null && progress >= 0) {
progressStr = String.format("%.2f%%", progress * 100);
}
Date startTime = info.getStartTime();
String timeStr = "";
if (startTime != null) {
timeStr = DATE_FORMAT.format(startTime);
}
return String
.format(HEADER_FORMAT, info.getId(), info.getUserAccount(), type, timeStr,
progressStr, status, info.getPriority(), runtimeUsage, totalUsage, queuePos);
}