|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.mapred.TaskController
public abstract class TaskController
Controls initialization, finalization and clean up of tasks, and
also the launching and killing of task JVMs.
This class defines the API for initializing, finalizing and cleaning
up of tasks, as also the launching and killing task JVMs.
Subclasses of this class will implement the logic required for
performing the actual actions.
NOTE: This class is internal only class and not intended for users!!
Field Summary | |
---|---|
protected LocalDirAllocator |
allocator
|
protected static String |
COMMAND_FILE
|
protected org.apache.hadoop.mapred.TaskTracker.LocalStorage |
localStorage
|
static org.apache.commons.logging.Log |
LOG
|
static FsPermission |
TASK_LAUNCH_SCRIPT_PERMISSION
|
Constructor Summary | |
---|---|
TaskController()
|
Method Summary | |
---|---|
abstract void |
createLogDir(TaskAttemptID taskID,
boolean isCleanup)
Creates task log dir |
abstract void |
deleteAsUser(String user,
String subDir)
Delete the user's files under all of the task tracker root directories. |
abstract void |
deleteLogAsUser(String user,
String subDir)
Delete the user's files under the userlogs directory. |
Configuration |
getConf()
Return the configuration used by this object. |
String[] |
getLocalDirs()
|
String |
getRunAsUser(JobConf conf)
Returns the local unix user that a given job will run as. |
abstract void |
initializeJob(String user,
String jobid,
Path credentials,
Path jobConf,
TaskUmbilicalProtocol taskTracker,
InetSocketAddress ttAddr)
Create all of the directories necessary for the job to start and download all of the job and private distributed cache files. |
abstract int |
launchTask(String user,
String jobId,
String attemptId,
List<String> setup,
List<String> jvmArguments,
File currentWorkDirectory,
String stdout,
String stderr)
Create all of the directories for the task and launches the child jvm. |
protected void |
logOutput(String output)
|
void |
setConf(Configuration conf)
Set the configuration to be used by this object. |
abstract void |
setup(LocalDirAllocator allocator,
org.apache.hadoop.mapred.TaskTracker.LocalStorage localStorage)
Does initialization and setup. |
abstract void |
signalTask(String user,
int taskPid,
ProcessTree.Signal signal)
Send a signal to a task pid as the user. |
abstract void |
truncateLogsAsUser(String user,
List<Task> allAttempts)
Run the passed command as the user |
protected static String |
writeCommand(String cmdLine,
FileSystem fs,
Path commandFile)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log LOG
protected static final String COMMAND_FILE
protected LocalDirAllocator allocator
protected org.apache.hadoop.mapred.TaskTracker.LocalStorage localStorage
public static final FsPermission TASK_LAUNCH_SCRIPT_PERMISSION
Constructor Detail |
---|
public TaskController()
Method Detail |
---|
public Configuration getConf()
Configurable
getConf
in interface Configurable
public String[] getLocalDirs()
public void setConf(Configuration conf)
Configurable
setConf
in interface Configurable
public abstract void setup(LocalDirAllocator allocator, org.apache.hadoop.mapred.TaskTracker.LocalStorage localStorage) throws IOException
allocator
- the local dir allocator to uselocalStorage
- local storage to obtain dirs from
IOException
public abstract void initializeJob(String user, String jobid, Path credentials, Path jobConf, TaskUmbilicalProtocol taskTracker, InetSocketAddress ttAddr) throws IOException, InterruptedException
user
- the user namejobid
- the jobcredentials
- a filename containing the job secretsjobConf
- the path to the localized configuration filetaskTracker
- the connection the task trackerttAddr
- the tasktracker's RPC address
IOException
InterruptedException
public abstract int launchTask(String user, String jobId, String attemptId, List<String> setup, List<String> jvmArguments, File currentWorkDirectory, String stdout, String stderr) throws IOException
user
- the user namejobId
- the jobId in questionattemptId
- the attempt id (cleanup attempts have .cleanup suffix)setup
- list of shell commands to execute before the jvmjvmArguments
- list of jvm argumentscurrentWorkDirectory
- the full path of the cwd for the taskstdout
- the file to redirect stdout tostderr
- the file to redirect stderr to
IOException
public abstract void signalTask(String user, int taskPid, ProcessTree.Signal signal) throws IOException
user
- the user nametaskPid
- the pid of the tasksignal
- the id of the signal to send
IOException
public abstract void deleteAsUser(String user, String subDir) throws IOException
user
- the user namesubDir
- the path relative to the user's subdirectory under
the task tracker root directories.
IOException
public abstract void createLogDir(TaskAttemptID taskID, boolean isCleanup) throws IOException
taskID
- ID of the taskisCleanup
- If the task is cleanup task or not
IOException
public abstract void deleteLogAsUser(String user, String subDir) throws IOException
user
- the user to work assubDir
- the path under the userlogs directory.
IOException
public abstract void truncateLogsAsUser(String user, List<Task> allAttempts) throws IOException
user
- allAttempts
- the list of attempts that the JVM ran
IOException
public String getRunAsUser(JobConf conf)
protected static String writeCommand(String cmdLine, FileSystem fs, Path commandFile) throws IOException
IOException
protected void logOutput(String output)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |