use of org.apache.tez.history.parser.datamodel.VersionInfo in project tez by apache.
the class ATSFileParser method processApplication.
/**
* Parse TezApplication json
*
* @param tezApplicationJson
* @throws JSONException
*/
private void processApplication(JSONObject tezApplicationJson) throws JSONException {
if (tezApplicationJson != null) {
LOG.debug("Started parsing tez application");
JSONObject otherInfoNode = tezApplicationJson.optJSONObject(Constants.OTHER_INFO);
if (otherInfoNode != null) {
JSONObject tezVersion = otherInfoNode.optJSONObject(Constants.TEZ_VERSION);
if (tezVersion != null) {
String version = tezVersion.optString(Constants.VERSION);
String buildTime = tezVersion.optString(Constants.BUILD_TIME);
String revision = tezVersion.optString(Constants.REVISION);
this.versionInfo = new VersionInfo(version, revision, buildTime);
}
// Parse Config info
this.config = Maps.newHashMap();
JSONObject configNode = otherInfoNode.getJSONObject(Constants.CONFIG);
Iterator it = configNode.keys();
while (it.hasNext()) {
String key = (String) it.next();
String value = configNode.getString(key);
config.put(key, value);
}
}
LOG.debug("Finished parsing tez application");
}
}
use of org.apache.tez.history.parser.datamodel.VersionInfo in project tez by apache.
the class TestHistoryParser method verifyDagInfo.
private void verifyDagInfo(DagInfo dagInfo, boolean ats) {
if (ats) {
VersionInfo versionInfo = dagInfo.getVersionInfo();
// should be present post 0.5.4
assertTrue(versionInfo != null);
assertTrue(versionInfo.getVersion() != null);
assertTrue(versionInfo.getRevision() != null);
assertTrue(versionInfo.getBuildTime() != null);
}
assertTrue(dagInfo.getUserName() != null);
assertTrue(!dagInfo.getUserName().isEmpty());
assertTrue(dagInfo.getStartTime() > 0);
assertTrue(dagInfo.getFinishTimeInterval() > 0);
assertTrue(dagInfo.getStartTimeInterval() == 0);
assertTrue(dagInfo.getStartTime() > 0);
if (dagInfo.getStatus().equalsIgnoreCase(DAGState.SUCCEEDED.toString())) {
assertTrue(dagInfo.getFinishTime() >= dagInfo.getStartTime());
}
assertTrue(dagInfo.getFinishTimeInterval() > dagInfo.getStartTimeInterval());
assertTrue(dagInfo.getStartTime() > dagInfo.getSubmitTime());
assertTrue(dagInfo.getTimeTaken() > 0);
assertNotNull(dagInfo.getCallerContext());
assertEquals("TezExamples", dagInfo.getCallerContext().getContext());
assertEquals("Tez WordCount Example Job", dagInfo.getCallerContext().getBlob());
assertNotNull(dagInfo.getCallerContext().getCallerId());
assertEquals("TezApplication", dagInfo.getCallerContext().getCallerType());
// Verify all vertices
for (VertexInfo vertexInfo : dagInfo.getVertices()) {
verifyVertex(vertexInfo, vertexInfo.getFailedTasksCount() > 0);
}
VertexInfo fastestVertex = dagInfo.getFastestVertex();
assertTrue(fastestVertex != null);
if (dagInfo.getStatus().equals(DAGState.SUCCEEDED)) {
assertTrue(dagInfo.getSlowestVertex() != null);
}
}
Aggregations