public abstract class TaskController extends Object implements Configurable
限定符和类型 | 字段和说明 |
---|---|
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 |
构造器和说明 |
---|
TaskController() |
限定符和类型 | 方法和说明 |
---|---|
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) |
public static final org.apache.commons.logging.Log LOG
protected LocalDirAllocator allocator
protected org.apache.hadoop.mapred.TaskTracker.LocalStorage localStorage
public static final FsPermission TASK_LAUNCH_SCRIPT_PERMISSION
public Configuration getConf()
Configurable
getConf
在接口中 Configurable
public String[] getLocalDirs()
public void setConf(Configuration conf)
Configurable
setConf
在接口中 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 fromIOException
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 addressIOException
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 toIOException
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 sendIOException
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 notIOException
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 ranIOException
public String getRunAsUser(JobConf conf)
protected static String writeCommand(String cmdLine, FileSystem fs, Path commandFile) throws IOException
IOException
protected void logOutput(String output)
Copyright © 2009 The Apache Software Foundation