1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 package org.apache.hadoop.tools.rumen;
19 
20 import org.apache.hadoop.mapred.JobConf;
21 import org.apache.hadoop.mapreduce.InputSplit;
22 import org.apache.hadoop.mapreduce.JobID;
23 import org.apache.hadoop.mapreduce.TaskType;
24 import org.apache.hadoop.tools.rumen.Pre21JobHistoryConstants.Values;
25 
26 /**
27  * {@link JobStory} represents the runtime information available for a
28  * completed Map-Reduce job.
29  */
30 public interface JobStory {
31 
32   /**
33    * Get the {@link JobConf} for the job.
34    * @return the <code>JobConf</code> for the job
35    */
getJobConf()36   public JobConf getJobConf();
37 
38   /**
39    * Get the job name.
40    * @return the job name
41    */
getName()42   public String getName();
43 
44   /**
45    * Get the job ID
46    * @return the job ID
47    */
getJobID()48   public JobID getJobID();
49 
50   /**
51    * Get the user who ran the job.
52    * @return the user who ran the job
53    */
getUser()54   public String getUser();
55 
56   /**
57    * Get the job submission time.
58    * @return the job submission time
59    */
getSubmissionTime()60   public long getSubmissionTime();
61 
62   /**
63    * Get the number of maps in the {@link JobStory}.
64    * @return the number of maps in the <code>Job</code>
65    */
getNumberMaps()66   public int getNumberMaps();
67 
68   /**
69    * Get the number of reduce in the {@link JobStory}.
70    * @return the number of reduces in the <code>Job</code>
71    */
getNumberReduces()72   public int getNumberReduces();
73 
74   /**
75    * Get the input splits for the job.
76    * @return the input splits for the job
77    */
getInputSplits()78   public InputSplit[] getInputSplits();
79 
80   /**
81    * Get {@link TaskInfo} for a given task.
82    * @param taskType {@link TaskType} of the task
83    * @param taskNumber Partition number of the task
84    * @return the <code>TaskInfo</code> for the given task
85    */
getTaskInfo(TaskType taskType, int taskNumber)86   public TaskInfo getTaskInfo(TaskType taskType, int taskNumber);
87 
88   /**
89    * Get {@link TaskAttemptInfo} for a given task-attempt, without regard to
90    * impact of locality (e.g. not needed to make scheduling decisions).
91    * @param taskType {@link TaskType} of the task-attempt
92    * @param taskNumber Partition number of the task-attempt
93    * @param taskAttemptNumber Attempt number of the task
94    * @return the <code>TaskAttemptInfo</code> for the given task-attempt
95    */
getTaskAttemptInfo(TaskType taskType, int taskNumber, int taskAttemptNumber)96   public TaskAttemptInfo getTaskAttemptInfo(TaskType taskType,
97                                             int taskNumber,
98                                             int taskAttemptNumber);
99 
100   /**
101    * Get {@link TaskAttemptInfo} for a given task-attempt, considering impact
102    * of locality.
103    * @param taskNumber Partition number of the task-attempt
104    * @param taskAttemptNumber Attempt number of the task
105    * @param locality Data locality of the task as scheduled in simulation
106    * @return the <code>TaskAttemptInfo</code> for the given task-attempt
107    */
108   public TaskAttemptInfo
getMapTaskAttemptInfoAdjusted(int taskNumber, int taskAttemptNumber, int locality)109     getMapTaskAttemptInfoAdjusted(int taskNumber,
110                                   int taskAttemptNumber,
111                                   int locality);
112 
113   /**
114    * Get the outcome of the job execution.
115    * @return The outcome of the job execution.
116    */
getOutcome()117   public Values getOutcome();
118 
119   /**
120    * Get the queue where the job is submitted.
121    * @return the queue where the job is submitted.
122    */
getQueueName()123   public String getQueueName();
124 }
125