@Override public VertexStatus getVertexStatus(String vertexName, Set<StatusGetOpts> statusOptions) throws IOException, TezException { final String url = String.format( "%s/%s?primaryFilter=%s:%s&secondaryFilter=vertexName:%s&fields=%s", baseUri, ATSConstants.TEZ_VERTEX_ID, ATSConstants.TEZ_DAG_ID, dagId, vertexName, FILTER_BY_FIELDS); try { VertexStatusProto.Builder statusBuilder; final JSONObject jsonRoot = getJsonRootEntity(url); JSONArray entitiesNode = jsonRoot.optJSONArray(ATSConstants.ENTITIES); if (entitiesNode == null || entitiesNode.length() != 1) { throw new TezException("Failed to get vertex status YARN Timeline"); } JSONObject vertexNode = entitiesNode.getJSONObject(0); statusBuilder = parseVertexStatus(vertexNode, statusOptions); if (statusBuilder == null) { throw new TezException("Failed to parse vertex status from YARN Timeline"); } return new VertexStatus(statusBuilder); } catch (JSONException je) { throw new TezException("Failed to parse VertexStatus json from YARN Timeline", je); } }
VertexStatus getVertexStatusViaAM(String vertexName, Set<StatusGetOpts> statusOptions) throws TezException, IOException { if (LOG.isDebugEnabled()) { LOG.debug("GetVertexStatus via AM for app: " + appId + " dag: " + dagId + " vertex: " + vertexName); } GetVertexStatusRequestProto.Builder requestProtoBuilder = GetVertexStatusRequestProto.newBuilder() .setDagId(dagId) .setVertexName(vertexName); if (statusOptions != null) { requestProtoBuilder.addAllStatusOptions( DagTypeConverters.convertStatusGetOptsToProto(statusOptions)); } try { return new VertexStatus( proxy.getVertexStatus(null, requestProtoBuilder.build()).getVertexStatus()); } catch (ServiceException e) { RPCUtil.unwrapAndThrowException(e); // Should not reach here throw new TezException(e); } }