本文整理汇总了Java中org.apache.hadoop.yarn.webapp.BadRequestException类的典型用法代码示例。如果您正苦于以下问题:Java BadRequestException类的具体用法?Java BadRequestException怎么用?Java BadRequestException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BadRequestException类属于org.apache.hadoop.yarn.webapp包,在下文中一共展示了BadRequestException类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNodeContainer
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/containers/{containerid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContainerInfo getNodeContainer(@PathParam("containerid") String id) {
ContainerId containerId = null;
init();
try {
containerId = ConverterUtils.toContainerId(id);
} catch (Exception e) {
throw new BadRequestException("invalid container id, " + id);
}
Container container = nmContext.getContainers().get(containerId);
if (container == null) {
throw new NotFoundException("container with id, " + id + ", not found");
}
return new ContainerInfo(this.nmContext, container, uriInfo.getBaseUri()
.toString(), webapp.name());
}
示例2: validateStates
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
private static void
validateStates(String stateQuery, Set<String> statesQuery) {
// stateQuery is deprecated.
if (stateQuery != null && !stateQuery.isEmpty()) {
statesQuery.add(stateQuery);
}
Set<String> appStates = parseQueries(statesQuery, true);
for (String appState : appStates) {
switch (YarnApplicationState.valueOf(
StringUtils.toUpperCase(appState))) {
case FINISHED:
case FAILED:
case KILLED:
continue;
default:
throw new BadRequestException("Invalid application-state " + appState
+ " specified. It should be a final state");
}
}
}
示例3: getJobTasks
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/jobs/{jobid}/tasks")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public TasksInfo getJobTasks(@Context HttpServletRequest hsr,
@PathParam("jobid") String jid, @QueryParam("type") String type) {
init();
Job job = getJobFromJobIdString(jid, appCtx);
checkAccess(job, hsr);
TasksInfo allTasks = new TasksInfo();
for (Task task : job.getTasks().values()) {
TaskType ttype = null;
if (type != null && !type.isEmpty()) {
try {
ttype = MRApps.taskType(type);
} catch (YarnRuntimeException e) {
throw new BadRequestException("tasktype must be either m or r");
}
}
if (ttype != null && task.getType() != ttype) {
continue;
}
allTasks.add(new TaskInfo(task));
}
return allTasks;
}
示例4: getJobTasks
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/mapreduce/jobs/{jobid}/tasks")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public TasksInfo getJobTasks(@Context HttpServletRequest hsr,
@PathParam("jobid") String jid, @QueryParam("type") String type) {
init();
Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
checkAccess(job, hsr);
TasksInfo allTasks = new TasksInfo();
for (Task task : job.getTasks().values()) {
TaskType ttype = null;
if (type != null && !type.isEmpty()) {
try {
ttype = MRApps.taskType(type);
} catch (YarnRuntimeException e) {
throw new BadRequestException("tasktype must be either m or r");
}
}
if (ttype != null && task.getType() != ttype) {
continue;
}
allTasks.add(new TaskInfo(task));
}
return allTasks;
}
示例5: getNodeContainer
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/containers/{containerid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContainerInfo getNodeContainer(@javax.ws.rs.core.Context
HttpServletRequest hsr, @PathParam("containerid") String id) {
ContainerId containerId = null;
init();
try {
containerId = ConverterUtils.toContainerId(id);
} catch (Exception e) {
throw new BadRequestException("invalid container id, " + id);
}
Container container = nmContext.getContainers().get(containerId);
if (container == null) {
throw new NotFoundException("container with id, " + id + ", not found");
}
return new ContainerInfo(this.nmContext, container, uriInfo.getBaseUri()
.toString(), webapp.name(), hsr.getRemoteUser());
}
示例6: postEntities
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
/**
* Store the given entities into the timeline store, and return the errors
* that happen during storing.
*/
@POST
@Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */})
public TimelinePutResponse postEntities(
@Context HttpServletRequest req,
@Context HttpServletResponse res,
TimelineEntities entities) {
init(res);
UserGroupInformation callerUGI = getUser(req);
if (callerUGI == null) {
String msg = "The owner of the posted timeline entities is not set";
LOG.error(msg);
throw new ForbiddenException(msg);
}
try {
return timelineDataManager.postEntities(entities, callerUGI);
} catch (BadRequestException bre) {
throw bre;
} catch (Exception e) {
LOG.error("Error putting entities", e);
throw new WebApplicationException(e,
Response.Status.INTERNAL_SERVER_ERROR);
}
}
示例7: validateStates
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
private static void
validateStates(String stateQuery, Set<String> statesQuery) {
// stateQuery is deprecated.
if (stateQuery != null && !stateQuery.isEmpty()) {
statesQuery.add(stateQuery);
}
Set<String> appStates = parseQueries(statesQuery, true);
for (String appState : appStates) {
switch (YarnApplicationState.valueOf(appState.toUpperCase())) {
case FINISHED:
case FAILED:
case KILLED:
continue;
default:
throw new BadRequestException("Invalid application-state " + appState
+ " specified. It should be a final state");
}
}
}
示例8: getJobTasks
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/mapreduce/jobs/{jobid}/tasks")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public TasksInfo getJobTasks(@PathParam("jobid") String jid,
@QueryParam("type") String type) {
init();
Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
TasksInfo allTasks = new TasksInfo();
for (Task task : job.getTasks().values()) {
TaskType ttype = null;
if (type != null && !type.isEmpty()) {
try {
ttype = MRApps.taskType(type);
} catch (YarnRuntimeException e) {
throw new BadRequestException("tasktype must be either m or r");
}
}
if (ttype != null && task.getType() != ttype) {
continue;
}
allTasks.add(new TaskInfo(task));
}
return allTasks;
}
示例9: parseApplicationId
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
public static ApplicationId parseApplicationId(RecordFactory recordFactory,
String appId) {
if (appId == null || appId.isEmpty()) {
throw new NotFoundException("appId, " + appId + ", is empty or null");
}
ApplicationId aid = null;
try {
aid = ApplicationId.fromString(appId);
} catch (Exception e) {
throw new BadRequestException(e);
}
if (aid == null) {
throw new NotFoundException("app with id " + appId + " not found");
}
return aid;
}
示例10: parseApplicationAttemptId
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
protected static ApplicationAttemptId parseApplicationAttemptId(
String appAttemptId) {
if (appAttemptId == null || appAttemptId.isEmpty()) {
throw new NotFoundException("appAttemptId, " + appAttemptId
+ ", is empty or null");
}
ApplicationAttemptId aaid = null;
try {
aaid = ApplicationAttemptId.fromString(appAttemptId);
} catch (Exception e) {
throw new BadRequestException(e);
}
if (aaid == null) {
throw new NotFoundException("appAttemptId is null");
}
return aaid;
}
示例11: parseContainerId
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
protected static ContainerId parseContainerId(String containerId) {
if (containerId == null || containerId.isEmpty()) {
throw new NotFoundException("containerId, " + containerId
+ ", is empty or null");
}
ContainerId cid = null;
try {
cid = ContainerId.fromString(containerId);
} catch (Exception e) {
throw new BadRequestException(e);
}
if (cid == null) {
throw new NotFoundException("containerId is null");
}
return cid;
}
示例12: getNodeContainer
import org.apache.hadoop.yarn.webapp.BadRequestException; //导入依赖的package包/类
@GET
@Path("/containers/{containerid}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ContainerInfo getNodeContainer(@javax.ws.rs.core.Context
HttpServletRequest hsr, @PathParam("containerid") String id) {
ContainerId containerId = null;
init();
try {
containerId = ContainerId.fromString(id);
} catch (Exception e) {
throw new BadRequestException("invalid container id, " + id);
}
Container container = nmContext.getContainers().get(containerId);
if (container == null) {
throw new NotFoundException("container with id, " + id + ", not found");
}
return new ContainerInfo(this.nmContext, container, uriInfo.getBaseUri()
.toString(), webapp.name(), hsr.getRemoteUser());
}