use of org.apache.hadoop.yarn.webapp.NotFoundException in project apex-core by apache.
the class StramWebServices method getLogicalOperator.
@GET
@Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getLogicalOperator(@PathParam("operatorName") String operatorName) throws Exception {
init();
OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
if (logicalOperator == null) {
throw new NotFoundException();
}
LogicalOperatorInfo logicalOperatorInfo = dagManager.getLogicalOperatorInfo(operatorName);
return new JSONObject(objectMapper.writeValueAsString(logicalOperatorInfo));
}
use of org.apache.hadoop.yarn.webapp.NotFoundException in project apex-core by apache.
the class StramWebServices method getPorts.
@GET
@Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/ports")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getPorts(@PathParam("operatorName") String operatorName) {
init();
OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
Set<LogicalPlan.InputPortMeta> inputPorts;
Set<LogicalPlan.OutputPortMeta> outputPorts;
if (logicalOperator == null) {
ModuleMeta logicalModule = dagManager.getModuleMeta(operatorName);
if (logicalModule == null) {
throw new NotFoundException();
}
inputPorts = logicalModule.getInputStreams().keySet();
outputPorts = logicalModule.getOutputStreams().keySet();
} else {
inputPorts = logicalOperator.getInputStreams().keySet();
outputPorts = logicalOperator.getOutputStreams().keySet();
}
JSONObject result = getPortsObjects(inputPorts, outputPorts);
return result;
}
use of org.apache.hadoop.yarn.webapp.NotFoundException in project apex-core by apache.
the class StramWebServices method getContainerStackTrace.
@GET
@Path(PATH_PHYSICAL_PLAN_CONTAINERS + "/{containerId}/" + PATH_STACKTRACE)
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getContainerStackTrace(@PathParam("containerId") String containerId) throws Exception {
init();
if (containerId.equals(System.getenv(ApplicationConstants.Environment.CONTAINER_ID.toString()))) {
return StramUtils.getStackTrace();
}
StreamingContainerAgent sca = dagManager.getContainerAgent(containerId);
if (sca == null) {
throw new NotFoundException("Container not found.");
}
if (!sca.getContainerInfo().state.equals("ACTIVE")) {
throw new NotFoundException("Container is not active.");
}
for (int i = 0; i < STACK_TRACE_ATTEMPTS; ++i) {
String result = sca.getStackTrace();
if (result != null) {
return new JSONObject(result);
}
Thread.sleep(STACK_TRACE_WAIT_TIME);
}
throw new TimeoutException("Not able to get the stack trace");
}
use of org.apache.hadoop.yarn.webapp.NotFoundException in project apex-core by apache.
the class StramWebServices method getOperatorAttributes.
@GET
@Path(PATH_LOGICAL_PLAN_OPERATORS + "/{operatorName}/attributes")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getOperatorAttributes(@PathParam("operatorName") String operatorName, @QueryParam("attributeName") String attributeName) {
init();
OperatorMeta logicalOperator = dagManager.getLogicalPlan().getOperatorMeta(operatorName);
if (logicalOperator == null) {
throw new NotFoundException();
}
HashMap<String, String> map = new HashMap<>();
for (Map.Entry<Attribute<?>, Object> entry : dagManager.getOperatorAttributes(operatorName).entrySet()) {
if (attributeName == null || entry.getKey().getSimpleName().equals(attributeName)) {
Map.Entry<Attribute<Object>, Object> entry1 = (Map.Entry<Attribute<Object>, Object>) (Map.Entry) entry;
map.put(entry1.getKey().getSimpleName(), entry1.getKey().codec.toString(entry1.getValue()));
}
}
return new JSONObject(map);
}
Aggregations