Search in sources :

Example 1 with TaskAttemptsInfo

use of org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptsInfo in project hadoop by apache.

the class AMWebServices method getJobTaskAttempts.

@GET
@Path("/jobs/{jobid}/tasks/{taskid}/attempts")
@Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 })
public TaskAttemptsInfo getJobTaskAttempts(@Context HttpServletRequest hsr, @PathParam("jobid") String jid, @PathParam("taskid") String tid) {
    init();
    TaskAttemptsInfo attempts = new TaskAttemptsInfo();
    Job job = getJobFromJobIdString(jid, appCtx);
    checkAccess(job, hsr);
    Task task = getTaskFromTaskIdString(tid, job);
    for (TaskAttempt ta : task.getAttempts().values()) {
        if (ta != null) {
            if (task.getType() == TaskType.REDUCE) {
                attempts.add(new ReduceTaskAttemptInfo(ta, task.getType()));
            } else {
                attempts.add(new TaskAttemptInfo(ta, task.getType(), true));
            }
        }
    }
    return attempts;
}
Also used : ReduceTaskAttemptInfo(org.apache.hadoop.mapreduce.v2.app.webapp.dao.ReduceTaskAttemptInfo) TaskAttemptsInfo(org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptsInfo) Task(org.apache.hadoop.mapreduce.v2.app.job.Task) TaskAttemptInfo(org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptInfo) ReduceTaskAttemptInfo(org.apache.hadoop.mapreduce.v2.app.webapp.dao.ReduceTaskAttemptInfo) TaskAttempt(org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt) Job(org.apache.hadoop.mapreduce.v2.app.job.Job) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 2 with TaskAttemptsInfo

use of org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptsInfo in project hadoop by apache.

the class HsWebServices method getJobTaskAttempts.

@GET
@Path("/mapreduce/jobs/{jobid}/tasks/{taskid}/attempts")
@Produces({ MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8, MediaType.APPLICATION_XML + "; " + JettyUtils.UTF_8 })
public TaskAttemptsInfo getJobTaskAttempts(@Context HttpServletRequest hsr, @PathParam("jobid") String jid, @PathParam("taskid") String tid) {
    init();
    TaskAttemptsInfo attempts = new TaskAttemptsInfo();
    Job job = AMWebServices.getJobFromJobIdString(jid, ctx);
    checkAccess(job, hsr);
    Task task = AMWebServices.getTaskFromTaskIdString(tid, job);
    for (TaskAttempt ta : task.getAttempts().values()) {
        if (ta != null) {
            if (task.getType() == TaskType.REDUCE) {
                attempts.add(new ReduceTaskAttemptInfo(ta, task.getType()));
            } else {
                attempts.add(new TaskAttemptInfo(ta, task.getType(), false));
            }
        }
    }
    return attempts;
}
Also used : ReduceTaskAttemptInfo(org.apache.hadoop.mapreduce.v2.app.webapp.dao.ReduceTaskAttemptInfo) TaskAttemptsInfo(org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptsInfo) Task(org.apache.hadoop.mapreduce.v2.app.job.Task) TaskAttemptInfo(org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptInfo) ReduceTaskAttemptInfo(org.apache.hadoop.mapreduce.v2.app.webapp.dao.ReduceTaskAttemptInfo) TaskAttempt(org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt) Job(org.apache.hadoop.mapreduce.v2.app.job.Job) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 Job (org.apache.hadoop.mapreduce.v2.app.job.Job)2 Task (org.apache.hadoop.mapreduce.v2.app.job.Task)2 TaskAttempt (org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt)2 ReduceTaskAttemptInfo (org.apache.hadoop.mapreduce.v2.app.webapp.dao.ReduceTaskAttemptInfo)2 TaskAttemptInfo (org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptInfo)2 TaskAttemptsInfo (org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptsInfo)2