You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by ac...@apache.org on 2011/09/13 02:05:53 UTC
svn commit: r1169980 [1/3] - in
/hadoop/common/trunk/hadoop-mapreduce-project: ./
hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/
hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/mai...
Author: acmurthy
Date: Tue Sep 13 00:05:51 2011
New Revision: 1169980
URL: http://svn.apache.org/viewvc?rev=1169980&view=rev
Log:
MAPREDUCE-2896. Simplify all apis to in org.apache.hadoop.yarn.api.records.* to be get/set only. Added javadocs to all public records.
Modified:
hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/local/LocalContainerAllocator.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRApp.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRAppBenchmark.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MockJobs.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedTaskAttempt.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/AMResponse.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerState.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerToken.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ProtoBase.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerIdPBImpl.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationContainerFinishedEvent.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationInitEvent.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainersLauncher.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AggregatedLogFormat.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/event/LogAggregatorContainerFinishedEvent.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerPage.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestEventFlow.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/TestContainer.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestLocalizedResource.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/TestLogAggregationService.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/TestContainersMonitor.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/webapp/TestNMWebServer.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/ApplicationMasterLauncher.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/recovery/ZKStore.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerNode.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerUtils.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockNM.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/NodeManager.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/TestUtils.java
hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/TestContainerTokenSecretManager.java
Modified: hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/CHANGES.txt Tue Sep 13 00:05:51 2011
@@ -282,6 +282,10 @@ Release 0.23.0 - Unreleased
MAPREDUCE-2675. Reformat JobHistory Server main page to be more
useful. (Robert Joseph Evans via vinodkv).
+ MAPREDUCE-2896. Simplify all apis to in
+ org.apache.hadoop.yarn.api.records.* to be get/set only. Added javadocs to
+ all public records. (acmurthy)
+
OPTIMIZATIONS
MAPREDUCE-2026. Make JobTracker.getJobCounters() and
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java Tue Sep 13 00:05:51 2011
@@ -137,6 +137,7 @@ public abstract class TaskAttemptImpl im
protected final Configuration conf;
protected final Path jobFile;
protected final int partition;
+ @SuppressWarnings("rawtypes")
protected final EventHandler eventHandler;
private final TaskAttemptId attemptId;
private final Clock clock;
@@ -431,7 +432,8 @@ public abstract class TaskAttemptImpl im
//this is the last status reported by the REMOTE running attempt
private TaskAttemptStatus reportedStatus;
- public TaskAttemptImpl(TaskId taskId, int i, EventHandler eventHandler,
+ public TaskAttemptImpl(TaskId taskId, int i,
+ @SuppressWarnings("rawtypes") EventHandler eventHandler,
TaskAttemptListener taskAttemptListener, Path jobFile, int partition,
Configuration conf, String[] dataLocalHosts, OutputCommitter committer,
Token<JobTokenIdentifier> jobToken,
@@ -527,6 +529,13 @@ public abstract class TaskAttemptImpl im
ContainerLaunchContext container =
recordFactory.newRecordInstance(ContainerLaunchContext.class);
+ // Application resources
+ Map<String, LocalResource> localResources =
+ new HashMap<String, LocalResource>();
+
+ // Application environment
+ Map<String, String> environment = new HashMap<String, String>();
+
try {
FileSystem remoteFS = FileSystem.get(conf);
@@ -535,7 +544,7 @@ public abstract class TaskAttemptImpl im
Path remoteJobJar = (new Path(remoteTask.getConf().get(
MRJobConfig.JAR))).makeQualified(remoteFS.getUri(),
remoteFS.getWorkingDirectory());
- container.setLocalResource(
+ localResources.put(
MRConstants.JOB_JAR,
createLocalResource(remoteFS, recordFactory, remoteJobJar,
LocalResourceType.FILE, LocalResourceVisibility.APPLICATION));
@@ -557,7 +566,7 @@ public abstract class TaskAttemptImpl im
new Path(path, oldJobId.toString());
Path remoteJobConfPath =
new Path(remoteJobSubmitDir, MRConstants.JOB_CONF_FILE);
- container.setLocalResource(
+ localResources.put(
MRConstants.JOB_CONF_FILE,
createLocalResource(remoteFS, recordFactory, remoteJobConfPath,
LocalResourceType.FILE, LocalResourceVisibility.APPLICATION));
@@ -565,9 +574,14 @@ public abstract class TaskAttemptImpl im
+ remoteJobConfPath.toUri().toASCIIString());
// //////////// End of JobConf setup
+
// Setup DistributedCache
- setupDistributedCache(remoteFS, conf, container);
+ setupDistributedCache(remoteFS, conf, localResources, environment);
+ // Set local-resources and environment
+ container.setLocalResources(localResources);
+ container.setEnv(environment);
+
// Setup up tokens
Credentials taskCredentials = new Credentials();
@@ -594,12 +608,12 @@ public abstract class TaskAttemptImpl im
// Add shuffle token
LOG.info("Putting shuffle token in serviceData");
- container
- .setServiceData(
- ShuffleHandler.MAPREDUCE_SHUFFLE_SERVICEID,
- ShuffleHandler.serializeServiceData(jobToken));
+ Map<String, ByteBuffer> serviceData = new HashMap<String, ByteBuffer>();
+ serviceData.put(ShuffleHandler.MAPREDUCE_SHUFFLE_SERVICEID,
+ ShuffleHandler.serializeServiceData(jobToken));
+ container.setServiceData(serviceData);
- MRApps.addToClassPath(container.getAllEnv(), getInitialClasspath());
+ MRApps.addToClassPath(container.getEnv(), getInitialClasspath());
} catch (IOException e) {
throw new YarnException(e);
}
@@ -622,11 +636,11 @@ public abstract class TaskAttemptImpl im
classPaths.add(workDir.toString()); // TODO
// Construct the actual Container
- container.addAllCommands(MapReduceChildJVM.getVMCommand(
+ container.setCommands(MapReduceChildJVM.getVMCommand(
taskAttemptListener.getAddress(), remoteTask, javaHome,
workDir.toString(), containerLogDir, childTmpDir, jvmID));
- MapReduceChildJVM.setVMEnv(container.getAllEnv(), classPaths,
+ MapReduceChildJVM.setVMEnv(container.getEnv(), classPaths,
workDir.toString(), containerLogDir, nmLdLibraryPath, remoteTask,
localizedApplicationTokensFile);
@@ -648,11 +662,15 @@ public abstract class TaskAttemptImpl im
return result;
}
- private void setupDistributedCache(FileSystem remoteFS, Configuration conf,
- ContainerLaunchContext container) throws IOException {
+ private void setupDistributedCache(FileSystem remoteFS,
+ Configuration conf,
+ Map<String, LocalResource> localResources,
+ Map<String, String> env)
+ throws IOException {
// Cache archives
- parseDistributedCacheArtifacts(remoteFS, container, LocalResourceType.ARCHIVE,
+ parseDistributedCacheArtifacts(remoteFS, localResources, env,
+ LocalResourceType.ARCHIVE,
DistributedCache.getCacheArchives(conf),
parseTimeStamps(DistributedCache.getArchiveTimestamps(conf)),
getFileSizes(conf, MRJobConfig.CACHE_ARCHIVES_SIZES),
@@ -660,7 +678,9 @@ public abstract class TaskAttemptImpl im
DistributedCache.getArchiveClassPaths(conf));
// Cache files
- parseDistributedCacheArtifacts(remoteFS, container, LocalResourceType.FILE,
+ parseDistributedCacheArtifacts(remoteFS,
+ localResources, env,
+ LocalResourceType.FILE,
DistributedCache.getCacheFiles(conf),
parseTimeStamps(DistributedCache.getFileTimestamps(conf)),
getFileSizes(conf, MRJobConfig.CACHE_FILES_SIZES),
@@ -672,7 +692,10 @@ public abstract class TaskAttemptImpl im
// Use TaskDistributedCacheManager.CacheFiles.makeCacheFiles(URI[],
// long[], boolean[], Path[], FileType)
private void parseDistributedCacheArtifacts(
- FileSystem remoteFS, ContainerLaunchContext container, LocalResourceType type,
+ FileSystem remoteFS,
+ Map<String, LocalResource> localResources,
+ Map<String, String> env,
+ LocalResourceType type,
URI[] uris, long[] timestamps, long[] sizes, boolean visibilities[],
Path[] pathsToPutOnClasspath) throws IOException {
@@ -709,7 +732,7 @@ public abstract class TaskAttemptImpl im
throw new IllegalArgumentException("Resource name must be relative");
}
String linkName = name.toUri().getPath();
- container.setLocalResource(
+ localResources.put(
linkName,
BuilderUtils.newLocalResource(
p.toUri(), type,
@@ -719,8 +742,7 @@ public abstract class TaskAttemptImpl im
sizes[i], timestamps[i])
);
if (classPaths.containsKey(u.getPath())) {
- Map<String, String> environment = container.getAllEnv();
- MRApps.addToClassPath(environment, linkName);
+ MRApps.addToClassPath(env, linkName);
}
}
}
@@ -892,6 +914,7 @@ public abstract class TaskAttemptImpl im
}
}
+ @SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
LOG.info("Processing " + event.getTaskAttemptID() +
@@ -1034,6 +1057,7 @@ public abstract class TaskAttemptImpl im
public RequestContainerTransition(boolean rescheduled) {
this.rescheduled = rescheduled;
}
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
TaskAttemptEvent event) {
@@ -1062,6 +1086,7 @@ public abstract class TaskAttemptImpl im
private static class ContainerAssignedTransition implements
SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(final TaskAttemptImpl taskAttempt,
TaskAttemptEvent event) {
@@ -1111,6 +1136,7 @@ public abstract class TaskAttemptImpl im
this.finalState = finalState;
this.withdrawsContainerRequest = withdrawsContainerRequest;
}
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
TaskAttemptEvent event) {
@@ -1157,6 +1183,7 @@ public abstract class TaskAttemptImpl im
private static class LaunchedContainerTransition implements
SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
TaskAttemptEvent evnt) {
@@ -1207,6 +1234,7 @@ public abstract class TaskAttemptImpl im
private static class CommitPendingTransition implements
SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
TaskAttemptEvent event) {
@@ -1218,6 +1246,7 @@ public abstract class TaskAttemptImpl im
private static class TaskCleanupTransition implements
SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
TaskAttemptEvent event) {
@@ -1233,6 +1262,7 @@ public abstract class TaskAttemptImpl im
private static class SucceededTransition implements
SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
TaskAttemptEvent event) {
@@ -1262,6 +1292,7 @@ public abstract class TaskAttemptImpl im
private static class FailedTransition implements
SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
// set the finish time
@@ -1286,6 +1317,7 @@ public abstract class TaskAttemptImpl im
}
}
+ @SuppressWarnings({ "unchecked" })
private void logAttemptFinishedEvent(TaskAttemptState state) {
//Log finished events only if an attempt started.
if (getLaunchTime() == 0) return;
@@ -1319,6 +1351,7 @@ public abstract class TaskAttemptImpl im
private static class TooManyFetchFailureTransition implements
SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt, TaskAttemptEvent event) {
//add to diagnostic
@@ -1346,6 +1379,7 @@ public abstract class TaskAttemptImpl im
private static class KilledTransition implements
SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
TaskAttemptEvent event) {
@@ -1372,6 +1406,7 @@ public abstract class TaskAttemptImpl im
private static class CleanupContainerTransition implements
SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
TaskAttemptEvent event) {
@@ -1398,6 +1433,7 @@ public abstract class TaskAttemptImpl im
private static class StatusUpdater
implements SingleArcTransition<TaskAttemptImpl, TaskAttemptEvent> {
+ @SuppressWarnings("unchecked")
@Override
public void transition(TaskAttemptImpl taskAttempt,
TaskAttemptEvent event) {
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/local/LocalContainerAllocator.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/local/LocalContainerAllocator.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/local/LocalContainerAllocator.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/local/LocalContainerAllocator.java Tue Sep 13 00:05:51 2011
@@ -70,7 +70,7 @@ public class LocalContainerAllocator ext
if (event.getType() == ContainerAllocator.EventType.CONTAINER_REQ) {
LOG.info("Processing the event " + event.toString());
ContainerId cID = recordFactory.newRecordInstance(ContainerId.class);
- cID.setAppId(appID);
+ cID.setApplicationAttemptId(applicationAttemptId);
// use negative ids to denote that these are local. Need a better way ??
cID.setId((-1) * containerCount.getAndIncrement());
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRApp.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRApp.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRApp.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRApp.java Tue Sep 13 00:05:51 2011
@@ -63,7 +63,6 @@ import org.apache.hadoop.mapreduce.v2.ap
import org.apache.hadoop.mapreduce.v2.app.taskclean.TaskCleanupEvent;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.Clock;
import org.apache.hadoop.yarn.YarnException;
import org.apache.hadoop.yarn.api.records.ApplicationId;
@@ -324,7 +323,7 @@ public class MRApp extends MRAppMaster {
@Override
public void handle(ContainerAllocatorEvent event) {
ContainerId cId = recordFactory.newRecordInstance(ContainerId.class);
- cId.setAppId(getContext().getApplicationID());
+ cId.setApplicationAttemptId(getContext().getApplicationAttemptId());
cId.setId(containerCount++);
Container container = recordFactory.newRecordInstance(Container.class);
container.setId(cId);
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRAppBenchmark.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRAppBenchmark.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRAppBenchmark.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRAppBenchmark.java Tue Sep 13 00:05:51 2011
@@ -30,6 +30,7 @@ import org.apache.hadoop.mapreduce.v2.ap
import org.apache.hadoop.mapreduce.v2.app.rm.ContainerAllocator;
import org.apache.hadoop.mapreduce.v2.app.rm.ContainerAllocatorEvent;
import org.apache.hadoop.yarn.YarnException;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.NodeId;
@@ -124,12 +125,15 @@ public class MRAppBenchmark {
try {
if (concurrentRunningTasks < maxConcurrentRunningTasks) {
event = eventQueue.take();
- ContainerId cId = recordFactory.newRecordInstance(ContainerId.class);
- cId.setAppId(getContext().getApplicationID());
+ ContainerId cId =
+ recordFactory.newRecordInstance(ContainerId.class);
+ cId.setApplicationAttemptId(
+ getContext().getApplicationAttemptId());
cId.setId(containerCount++);
//System.out.println("Allocating " + containerCount);
- Container container = recordFactory.newRecordInstance(Container.class);
+ Container container =
+ recordFactory.newRecordInstance(Container.class);
container.setId(cId);
NodeId nodeId = recordFactory.newRecordInstance(NodeId.class);
nodeId.setHost("dummy");
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MockJobs.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MockJobs.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MockJobs.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MockJobs.java Tue Sep 13 00:05:51 2011
@@ -51,6 +51,7 @@ import org.apache.hadoop.mapreduce.v2.ap
import org.apache.hadoop.mapreduce.v2.app.job.impl.JobImpl;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.MockApps;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.util.Records;
@@ -235,7 +236,11 @@ public class MockJobs extends MockApps {
@Override
public ContainerId getAssignedContainerID() {
ContainerId id = Records.newRecord(ContainerId.class);
- id.setAppId(taid.getTaskId().getJobId().getAppId());
+ ApplicationAttemptId appAttemptId =
+ Records.newRecord(ApplicationAttemptId.class);
+ appAttemptId.setApplicationId(taid.getTaskId().getJobId().getAppId());
+ appAttemptId.setAttemptId(0);
+ id.setApplicationAttemptId(appAttemptId);
return id;
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedTaskAttempt.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedTaskAttempt.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedTaskAttempt.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedTaskAttempt.java Tue Sep 13 00:05:51 2011
@@ -29,6 +29,7 @@ import org.apache.hadoop.mapreduce.v2.ap
import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState;
import org.apache.hadoop.mapreduce.v2.api.records.TaskId;
import org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
@@ -82,12 +83,23 @@ public class CompletedTaskAttempt implem
@Override
public ContainerId getAssignedContainerID() {
- //TODO ContainerId needs to be part of some historyEvent to be able to render the log directory.
- ContainerId containerId = RecordFactoryProvider.getRecordFactory(null).newRecordInstance(ContainerId.class);
+ //TODO ContainerId needs to be part of some historyEvent to be able to
+ //render the log directory.
+ ContainerId containerId =
+ RecordFactoryProvider.getRecordFactory(null).newRecordInstance(
+ ContainerId.class);
containerId.setId(-1);
- containerId.setAppId(RecordFactoryProvider.getRecordFactory(null).newRecordInstance(ApplicationId.class));
- containerId.getAppId().setId(-1);
- containerId.getAppId().setClusterTimestamp(-1);
+ ApplicationAttemptId applicationAttemptId =
+ RecordFactoryProvider.getRecordFactory(null).newRecordInstance(
+ ApplicationAttemptId.class);
+ applicationAttemptId.setAttemptId(-1);
+ ApplicationId applicationId =
+ RecordFactoryProvider.getRecordFactory(null).newRecordInstance(
+ ApplicationId.class);
+ applicationId.setClusterTimestamp(-1);
+ applicationId.setId(-1);
+ applicationAttemptId.setApplicationId(applicationId);
+ containerId.setApplicationAttemptId(applicationAttemptId);
return containerId;
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/main/java/org/apache/hadoop/mapred/YARNRunner.java Tue Sep 13 00:05:51 2011
@@ -348,7 +348,6 @@ public class YARNRunner implements Clien
// Add { job jar, MR app jar } to classpath.
Map<String, String> environment = new HashMap<String, String>();
-// appContext.environment = new HashMap<CharSequence, CharSequence>();
MRApps.setInitialClasspath(environment);
MRApps.addToClassPath(environment, MRConstants.JOB_JAR);
MRApps.addToClassPath(environment,
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/AMResponse.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/AMResponse.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/AMResponse.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/AMResponse.java Tue Sep 13 00:05:51 2011
@@ -119,11 +119,7 @@ public interface AMResponse {
@Stable
public List<ContainerStatus> getCompletedContainersStatuses();
- /**
- * Set the list of list of <em>completed containers' statuses</em>.
- * @param containers list of <em>completed containers' statuses</em>
- */
- @Public
- @Stable
+ @Private
+ @Unstable
public void setCompletedContainersStatuses(List<ContainerStatus> containers);
}
\ No newline at end of file
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptId.java Tue Sep 13 00:05:51 2011
@@ -20,12 +20,44 @@ package org.apache.hadoop.yarn.api.recor
import java.text.NumberFormat;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+
+/**
+ * <p><code>ApplicationAttemptId</code> denotes the particular <em>attempt</em>
+ * of an <code>ApplicationMaster</code> for a given {@link ApplicationId}.</p>
+ *
+ * <p>Multiple attempts might be needed to run an application to completion due
+ * to temporal failures of the <code>ApplicationMaster</code> such as hardware
+ * failures, connectivity issues etc. on the node on which it was scheduled.</p>
+ */
+@Public
+@Stable
public abstract class ApplicationAttemptId implements
Comparable<ApplicationAttemptId> {
+
+ /**
+ * Get the <code>ApplicationId</code> of the <code>ApplicationAttempId</code>.
+ * @return <code>ApplicationId</code> of the <code>ApplicationAttempId</code>
+ */
+ @Public
+ @Stable
public abstract ApplicationId getApplicationId();
- public abstract int getAttemptId();
+ @Private
+ @Unstable
public abstract void setApplicationId(ApplicationId appID);
+
+ /**
+ * Get the <code>attempt id</code> of the <code>Application</code>.
+ * @return <code>attempt id</code> of the <code>Application</code>
+ */
+ public abstract int getAttemptId();
+
+ @Private
+ @Unstable
public abstract void setAttemptId(int attemptId);
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java Tue Sep 13 00:05:51 2011
@@ -18,11 +18,47 @@
package org.apache.hadoop.yarn.api.records;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+
+/**
+ * <p><code>ApplicationId</code> represents the <em>globally unique</em>
+ * identifier for an application.</p>
+ *
+ * <p>The globally unique nature of the identifier is achieved by using the
+ * <em>cluster timestamp</em> i.e. start-time of the
+ * <code>ResourceManager</code> along with a monotonically increasing counter
+ * for the application.</p>
+ */
+@Public
+@Stable
public abstract class ApplicationId implements Comparable<ApplicationId> {
+
+ /**
+ * Get the short integer identifier of the <code>ApplicationId</code>
+ * which is unique for all applications started by a particular instance
+ * of the <code>ResourceManager</code>.
+ * @return short integer identifier of the <code>ApplicationId</code>
+ */
+ @Public
+ @Stable
public abstract int getId();
- public abstract long getClusterTimestamp();
+ @Private
+ @Unstable
public abstract void setId(int id);
+
+ /**
+ * Get the <em>start time</em> of the <code>ResourceManager</code> which is
+ * used to generate globally unique <code>ApplicationId</code>.
+ * @return <em>start time</em> of the <code>ResourceManager</code>
+ */
+ public abstract long getClusterTimestamp();
+
+ @Private
+ @Unstable
public abstract void setClusterTimestamp(long clusterTimestamp);
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationMaster.java Tue Sep 13 00:05:51 2011
@@ -18,26 +18,43 @@
package org.apache.hadoop.yarn.api.records;
-//TODO: Split separate object for register, deregister and in-RM use.
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+
+/**
+ * <em>For internal use only...</em>
+ */
+@Private
+@Unstable
public interface ApplicationMaster {
ApplicationId getApplicationId();
- String getHost();
- int getRpcPort();
- String getTrackingUrl();
- ApplicationStatus getStatus();
- ApplicationState getState();
- String getClientToken();
- int getAMFailCount();
- int getContainerCount();
- String getDiagnostics();
void setApplicationId(ApplicationId appId);
+
+ String getHost();
void setHost(String host);
+
+ int getRpcPort();
void setRpcPort(int rpcPort);
+
+ String getTrackingUrl();
void setTrackingUrl(String url);
+
+ ApplicationStatus getStatus();
void setStatus(ApplicationStatus status);
+
+ ApplicationState getState();
void setState(ApplicationState state);
+
+ String getClientToken();
void setClientToken(String clientToken);
+
+ int getAMFailCount();
void setAMFailCount(int amFailCount);
+
+ int getContainerCount();
void setContainerCount(int containerCount);
+
+ String getDiagnostics();
void setDiagnostics(String diagnostics);
}
+
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationState.java Tue Sep 13 00:05:51 2011
@@ -18,6 +18,30 @@
package org.apache.hadoop.yarn.api.records;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+
+/**
+ * Ennumeration of various states of an <code>Application</code>.
+ */
+@Public
+@Stable
public enum ApplicationState {
- NEW, SUBMITTED, RUNNING, SUCCEEDED, FAILED, KILLED
+ /** Application which was just created. */
+ NEW,
+
+ /** Application which has been submitted. */
+ SUBMITTED,
+
+ /** Application which is currently running. */
+ RUNNING,
+
+ /** Application which completed successfully. */
+ SUCCEEDED,
+
+ /** Application which failed. */
+ FAILED,
+
+ /** Application which was terminated by a user or admin. */
+ KILLED
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationStatus.java Tue Sep 13 00:05:51 2011
@@ -18,12 +18,21 @@
package org.apache.hadoop.yarn.api.records;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+
+/**
+ * <em>For internal use only...</em>
+ */
+@Private
+@Unstable
public interface ApplicationStatus {
ApplicationAttemptId getApplicationAttemptId();
- int getResponseId();
- float getProgress();
-
void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId);
+
+ int getResponseId();
void setResponseId(int id);
+
+ float getProgress();
void setProgress(float progress);
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Container.java Tue Sep 13 00:05:51 2011
@@ -18,21 +18,133 @@
package org.apache.hadoop.yarn.api.records;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.AMRMProtocol;
+import org.apache.hadoop.yarn.api.ContainerManager;
+/**
+ * <p><code>Container</code> represents an allocated resource in the cluster.
+ * </p>
+ *
+ * <p>The <code>ResourceManager</code> is the sole authority to allocate any
+ * <code>Container</code> to applications. The allocated <code>Container</code>
+ * is always on a single node and has a unique {@link ContainerId}. It has
+ * a specific amount of {@link Resource} allocated.</p>
+ *
+ * <p>It includes details such as:
+ * <ul>
+ * <li>{@link ContainerId} for the container, which is globally unique.</li>
+ * <li>
+ * {@link NodeId} of the node on which identifies the node on which it
+ * is allocated.
+ * </li>
+ * <li>HTTP uri of the node.</li>
+ * <li>{@link Resource} allocated to the container.</li>
+ * <li>{@link ContainerState} of the container.</li>
+ * <li>
+ * {@link ContainerToken} of the container, used to securely verify
+ * authenticity of the allocation.
+ * </li>
+ * <li>{@link ContainerStatus} of the container.</li>
+ * </ul>
+ * </p>
+ *
+ * <p>Typically, an <code>ApplicationMaster</code> receives the
+ * <code>Container</code> from the <code>ResourceManager</code> during
+ * resource-negotiation and then talks to the <code>NodManager</code> to
+ * start/stop containers.</p>
+ *
+ * @see AMRMProtocol#allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest)
+ * @see ContainerManager#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
+ * @see ContainerManager#stopContainer(org.apache.hadoop.yarn.api.protocolrecords.StopContainerRequest)
+ */
+@Public
+@Stable
public interface Container extends Comparable<Container> {
+ /**
+ * Get the globally unique identifier for the container.
+ * @return globally unique identifier for the container
+ */
+ @Public
+ @Stable
ContainerId getId();
- NodeId getNodeId();
- String getNodeHttpAddress();
- Resource getResource();
- ContainerState getState();
- ContainerToken getContainerToken();
- ContainerStatus getContainerStatus();
+ @Private
+ @Unstable
void setId(ContainerId id);
+
+ /**
+ * Get the identifier of the node on which the container is allocated.
+ * @return identifier of the node on which the container is allocated
+ */
+ @Public
+ @Stable
+ NodeId getNodeId();
+
+ @Private
+ @Unstable
void setNodeId(NodeId nodeId);
+
+ /**
+ * Get the http uri of the node on which the container is allocated.
+ * @return http uri of the node on which the container is allocated
+ */
+ @Public
+ @Stable
+ String getNodeHttpAddress();
+
+ @Private
+ @Unstable
void setNodeHttpAddress(String nodeHttpAddress);
+
+ /**
+ * Get the <code>Resource</code> allocated to the container.
+ * @return <code>Resource</code> allocated to the container
+ */
+ @Public
+ @Stable
+ Resource getResource();
+
+ @Private
+ @Unstable
void setResource(Resource resource);
+
+ /**
+ * Get the current <code>ContainerState</code> of the container.
+ * @return current <code>ContainerState</code> of the container
+ */
+ @Public
+ @Stable
+ ContainerState getState();
+
+ @Private
+ @Unstable
void setState(ContainerState state);
+
+ /**
+ * Get the <code>ContainerToken</code> for the container.
+ * @return <code>ContainerToken</code> for the container
+ */
+ @Public
+ @Stable
+ ContainerToken getContainerToken();
+
+ @Private
+ @Unstable
void setContainerToken(ContainerToken containerToken);
+
+ /**
+ * Get the <code>ContainerStatus</code> of the container.
+ * @return <code>ContainerStatus</code> of the container
+ */
+ @Public
+ @Stable
+ ContainerStatus getContainerStatus();
+
+ @Private
+ @Unstable
void setContainerStatus(ContainerStatus containerStatus);
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java Tue Sep 13 00:05:51 2011
@@ -20,13 +20,42 @@ package org.apache.hadoop.yarn.api.recor
import java.text.NumberFormat;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+
+/**
+ * <p><code>ContainerId</code> represents a globally unique identifier
+ * for a {@link Container} in the cluster.</p>
+ */
+@Public
+@Stable
public abstract class ContainerId implements Comparable<ContainerId>{
- public abstract ApplicationAttemptId getAppAttemptId();
- public abstract ApplicationId getAppId();
- public abstract int getId();
+ /**
+ * Get the <code>ApplicationAttemptId</code> of the application to which
+ * the <code>Container</code> was assigned.
+ * @return <code>ApplicationAttemptId</code> of the application to which
+ * the <code>Container</code> was assigned
+ */
+ @Public
+ @Stable
+ public abstract ApplicationAttemptId getApplicationAttemptId();
- public abstract void setAppAttemptId(ApplicationAttemptId atId);
- public abstract void setAppId(ApplicationId appID);
+ @Private
+ @Unstable
+ public abstract void setApplicationAttemptId(ApplicationAttemptId atId);
+
+ /**
+ * Get the identifier of the <code>ContainerId</code>.
+ * @return identifier of the <code>ContainerId</code>
+ */
+ @Public
+ @Stable
+ public abstract int getId();
+
+ @Private
+ @Unstable
public abstract void setId(int id);
@@ -74,7 +103,7 @@ public abstract class ContainerId implem
int result = 1;
result = prime * result + getId();
result = prime * result
- + ((getAppAttemptId() == null) ? 0 : getAppAttemptId().hashCode());
+ + ((getApplicationAttemptId() == null) ? 0 : getApplicationAttemptId().hashCode());
return result;
}
@@ -85,7 +114,8 @@ public abstract class ContainerId implem
}
if (other.getClass().isAssignableFrom(this.getClass())) {
ContainerId otherCId = (ContainerId)other;
- if (this.getAppAttemptId().equals(otherCId.getAppAttemptId())) {
+ if (this.getApplicationAttemptId().equals(
+ otherCId.getApplicationAttemptId())) {
return this.getId() == otherCId.getId();
}
}
@@ -94,10 +124,12 @@ public abstract class ContainerId implem
@Override
public int compareTo(ContainerId other) {
- if (this.getAppAttemptId().compareTo(other.getAppAttemptId()) == 0) {
+ if (this.getApplicationAttemptId().compareTo(
+ other.getApplicationAttemptId()) == 0) {
return this.getId() - other.getId();
} else {
- return this.getAppAttemptId().compareTo(other.getAppAttemptId());
+ return this.getApplicationAttemptId().compareTo(
+ other.getApplicationAttemptId());
}
}
@@ -105,10 +137,10 @@ public abstract class ContainerId implem
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- ApplicationId appId = getAppId();
+ ApplicationId appId = getApplicationAttemptId().getApplicationId();
sb.append("container_").append(appId.getClusterTimestamp()).append("_");
sb.append(appIdFormat.get().format(appId.getId())).append("_");
- sb.append(appAttemptIdFormat.get().format(getAppAttemptId().
+ sb.append(appAttemptIdFormat.get().format(getApplicationAttemptId().
getAttemptId())).append("_");
sb.append(containerIdFormat.get().format(getId()));
return sb.toString();
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java Tue Sep 13 00:05:51 2011
@@ -22,10 +22,8 @@ import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
-import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
-import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ContainerManager;
/**
@@ -121,100 +119,52 @@ public interface ContainerLaunchContext
void setContainerTokens(ByteBuffer containerToken);
/**
- * Get all <code>LocalResource</code> required by the container.
+ * Get <code>LocalResource</code> required by the container.
* @return all <code>LocalResource</code> required by the container
*/
@Public
@Stable
- Map<String, LocalResource> getAllLocalResources();
+ Map<String, LocalResource> getLocalResources();
- @Private
- @Unstable
- LocalResource getLocalResource(String key);
-
/**
- * Add all <code>LocalResource</code> required by the container.
+ * Set <code>LocalResource</code> required by the container.
* @param localResources <code>LocalResource</code> required by the container
*/
@Public
@Stable
- void addAllLocalResources(Map<String, LocalResource> localResources);
-
- @Private
- @Unstable
- void setLocalResource(String key, LocalResource value);
-
- @Private
- @Unstable
- void removeLocalResource(String key);
-
- @Private
- @Unstable
- void clearLocalResources();
+ void setLocalResources(Map<String, LocalResource> localResources);
/**
- * Get application-specific binary service data.
- * @return application-specific binary service data
+ * Get application-specific binary <em>service data</em>.
+ * @return application-specific binary <em>service data</em>
*/
@Public
@Stable
- Map<String, ByteBuffer> getAllServiceData();
+ Map<String, ByteBuffer> getServiceData();
- @Private
- @Unstable
- ByteBuffer getServiceData(String key);
-
/**
- * Add add application-specific binary service data.
- * @param serviceData application-specific binary service data
+ * Set application-specific binary <em>service data</em>.
+ * @param serviceData application-specific binary <em>service data</em>
*/
@Public
@Stable
- void addAllServiceData(Map<String, ByteBuffer> serviceData);
-
- @Private
- @Unstable
- void setServiceData(String key, ByteBuffer value);
-
- @Private
- @Unstable
- void removeServiceData(String key);
-
- @Private
- @Unstable
- void clearServiceData();
+ void setServiceData(Map<String, ByteBuffer> serviceData);
/**
- * Get <em>environment variables</em> for the launched container.
- * @return <em>environment variables</em> for the launched container
+ * Get <em>environment variables</em> for the container.
+ * @return <em>environment variables</em> for the container
*/
@Public
@Stable
- Map<String, String> getAllEnv();
-
- @Private
- @Unstable
- String getEnv(String key);
-
+ Map<String, String> getEnv();
+
/**
- * Add <em>environment variables</em> for the launched container.
- * @param env <em>environment variables</em> for the launched container
+ * Add <em>environment variables</em> for the container.
+ * @param environment <em>environment variables</em> for the container
*/
@Public
@Stable
- void addAllEnv(Map<String, String> env);
-
- @Private
- @Unstable
- void setEnv(String key, String value);
-
- @Private
- @Unstable
- void removeEnv(String key);
-
- @Private
- @Unstable
- void clearEnv();
+ void setEnv(Map<String, String> environment);
/**
* Get the list of <em>commands</em> for launching the container.
@@ -222,15 +172,7 @@ public interface ContainerLaunchContext
*/
@Public
@Stable
- List<String> getCommandList();
-
- @Private
- @Unstable
- String getCommand(int index);
-
- @Private
- @Unstable
- int getCommandCount();
+ List<String> getCommands();
/**
* Add the list of <em>commands</em> for launching the container.
@@ -238,17 +180,6 @@ public interface ContainerLaunchContext
*/
@Public
@Stable
- void addAllCommands(List<String> commands);
-
- @Private
- @Unstable
- void addCommand(String command);
-
- @Private
- @Unstable
- void removeCommand(int index);
+ void setCommands(List<String> commands);
- @Private
- @Unstable
- void clearCommands();
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerState.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerState.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerState.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerState.java Tue Sep 13 00:05:51 2011
@@ -18,6 +18,16 @@
package org.apache.hadoop.yarn.api.records;
+/**
+ * <p>State of a <code>Container</code>.</p>
+ */
public enum ContainerState {
- NEW, RUNNING, COMPLETE
+ /** New container */
+ NEW,
+
+ /** Running container */
+ RUNNING,
+
+ /** Completed container */
+ COMPLETE
}
\ No newline at end of file
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java Tue Sep 13 00:05:51 2011
@@ -18,14 +18,81 @@
package org.apache.hadoop.yarn.api.records;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+
+/**
+ * <p><code>ContainerStatus</code> represents the current status of a
+ * <code>Container</code>.</p>
+ *
+ * <p>It provides details such as:
+ * <ul>
+ * <li><code>ContainerId</code> of the container.</li>
+ * <li><code>ContainerState</code> of the container.</li>
+ * <li><em>Exit status</em> of a completed container.</li>
+ * <li><em>Diagnostic</em> message for a failed container.</li>
+ * </ul>
+ * </p>
+ */
+@Public
+@Stable
public interface ContainerStatus {
+ /**
+ * Get the <code>ContainerId</code> of the container.
+ * @return <code>ContainerId</code> of the container
+ */
+ @Public
+ @Stable
ContainerId getContainerId();
- ContainerState getState();
- String getExitStatus();
- String getDiagnostics();
+ @Private
+ @Unstable
void setContainerId(ContainerId containerId);
+
+ /**
+ * Get the <code>ContainerState</code> of the container.
+ * @return <code>ContainerState</code> of the container
+ */
+ @Public
+ @Stable
+ ContainerState getState();
+
+ @Private
+ @Unstable
void setState(ContainerState state);
- void setExitStatus(String exitStatus);
+
+ /**
+ * <p>Get the <em>exit status</em> for the container.</p>
+ *
+ * <p>Note: This is valid only for completed containers i.e. containers
+ * with state {@link ContainerState#COMPLETE}.
+ * Otherwise, it returns an invalid exit code equal to {@literal -1000};</p>
+ *
+ * <p>Container killed by the framework, either due to being released by
+ * the application or being 'lost' due to node failures etc. have a special
+ * exit code of {@literal -100}.</p>
+ *
+ * @return <em>exit status</em> for the container
+ */
+ @Public
+ @Stable
+ int getExitStatus();
+
+ @Private
+ @Unstable
+ void setExitStatus(int exitStatus);
+
+ /**
+ * Get <em>diagnostic messages</em> for failed containers.
+ * @return <em>diagnostic messages</em> for failed containers
+ */
+ @Public
+ @Stable
+ String getDiagnostics();
+
+ @Private
+ @Unstable
void setDiagnostics(String diagnostics);
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerToken.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerToken.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerToken.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerToken.java Tue Sep 13 00:05:51 2011
@@ -20,15 +20,76 @@ package org.apache.hadoop.yarn.api.recor
import java.nio.ByteBuffer;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.yarn.api.AMRMProtocol;
+import org.apache.hadoop.yarn.api.ContainerManager;
+
+/**
+ * <p><code>ContainerToken</code> is the security token used by the framework
+ * to verify authenticity of any <code>Container</code>.</p>
+ *
+ * <p>The <code>ResourceManager</code>, on container allocation provides a
+ * secure token which is verified by the <code>NodeManager</code> on
+ * container launch.</p>
+ *
+ * <p>Applications do not need to care about <code>ContainerToken</code>, they
+ * are transparently handled by the framework - the allocated
+ * <code>Container</code> includes the <code>ContainerToken</code>.</p>
+ *
+ * @see AMRMProtocol#allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest)
+ * @see ContainerManager#startContainer(org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest)
+ */
+@Public
+@Stable
public interface ContainerToken {
+ /**
+ * Get the token identifier.
+ * @return token identifier
+ */
+ @Public
+ @Stable
public abstract ByteBuffer getIdentifier();
- public abstract ByteBuffer getPassword();
- public abstract String getKind();
- public abstract String getService();
+ @Private
+ @Stable
public abstract void setIdentifier(ByteBuffer identifier);
+
+ /**
+ * Get the token password
+ * @return token password
+ */
+ @Public
+ @Stable
+ public abstract ByteBuffer getPassword();
+
+ @Private
+ @Stable
public abstract void setPassword(ByteBuffer password);
+
+ /**
+ * Get the token kind.
+ * @return token kind
+ */
+ @Public
+ @Stable
+ public abstract String getKind();
+
+ @Private
+ @Stable
public abstract void setKind(String kind);
+
+ /**
+ * Get the service to which the token is allocated.
+ * @return service to which the token is allocated
+ */
+ @Public
+ @Stable
+ public abstract String getService();
+
+ @Private
+ @Stable
public abstract void setService(String service);
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java Tue Sep 13 00:05:51 2011
@@ -18,11 +18,43 @@
package org.apache.hadoop.yarn.api.records;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+
+/**
+ * <p><code>NodeId</code> is the unique identifier for a node.</p>
+ *
+ * <p>It includes the <em>hostname</em> and <em>port</em> to uniquely
+ * identify the node. Thus, it is unique across restarts of any
+ * <code>NodeManager</code>.</p>
+ */
+@Public
+@Stable
public interface NodeId extends Comparable<NodeId> {
+ /**
+ * Get the <em>hostname</em> of the node.
+ * @return <em>hostname</em> of the node
+ */
+ @Public
+ @Stable
String getHost();
+
+ @Private
+ @Unstable
void setHost(String host);
+ /**
+ * Get the <em>port</em> for communicating with the node.
+ * @return <em>port</em> for communicating with the node
+ */
+ @Public
+ @Stable
int getPort();
+
+ @Private
+ @Unstable
void setPort(int port);
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ProtoBase.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ProtoBase.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ProtoBase.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ProtoBase.java Tue Sep 13 00:05:51 2011
@@ -20,11 +20,15 @@ package org.apache.hadoop.yarn.api.recor
import java.nio.ByteBuffer;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.ProtoUtils;
import com.google.protobuf.ByteString;
import com.google.protobuf.Message;
+@Private
+@Unstable
public abstract class ProtoBase <T extends Message> {
public abstract T getProto();
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/Resource.java Tue Sep 13 00:05:51 2011
@@ -18,10 +18,40 @@
package org.apache.hadoop.yarn.api.records;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.yarn.api.AMRMProtocol;
+
+/**
+ * <p><code>Resource</code> models a set of computer resources in the
+ * cluster.</p>
+ *
+ * <p>Currrently it only models <em>memory</em>.</p>
+ *
+ * <p>Typically, applications request <code>Resource</code> of suitable
+ * capability to run their component tasks.</p>
+ *
+ * @see ResourceRequest
+ * @see AMRMProtocol#allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest)
+ */
+@Public
+@Stable
public interface Resource extends Comparable<Resource> {
+
+ /**
+ * Get <em>memory</em> of the resource.
+ * @return <em>memory</em> of the resource
+ */
+ @Public
+ @Stable
public abstract int getMemory();
+ /**
+ * Set <em>memory</em> of the resource.
+ * @param memory <em>memory</em> of the resource
+ */
+ @Public
+ @Stable
public abstract void setMemory(int memory);
-
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceRequest.java Tue Sep 13 00:05:51 2011
@@ -18,16 +18,107 @@
package org.apache.hadoop.yarn.api.records;
-public interface ResourceRequest extends Comparable<ResourceRequest>{
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.yarn.api.AMRMProtocol;
+
+/**
+ * <p><code>ResourceRequest</code> represents the request made by an
+ * application to the <code>ResourceManager</code> to obtain various
+ * <code>Container</code> allocations.</p>
+ *
+ * <p>It includes:
+ * <ul>
+ * <li>{@link Priority} of the request.</li>
+ * <li>
+ * The <em>name</em> of the machine or rack on which the allocation is
+ * desired. A special value of <em>*</em> signifies that
+ * <em>any</em> host/rack is acceptable to the application.
+ * </li>
+ * <li>{@link Resource} required for each request.</li>
+ * <li>
+ * Number of containers of such specifications which are required
+ * by the application.
+ * </li>
+ * </ul>
+ * </p>
+ *
+ * @see Resource
+ * @see AMRMProtocol#allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest)
+ */
+@Public
+@Stable
+public interface ResourceRequest extends Comparable<ResourceRequest> {
+ /**
+ * Get the <code>Priority</code> of the request.
+ * @return <code>Priority</code> of the request
+ */
+ @Public
+ @Stable
public abstract Priority getPriority();
+
+ /**
+ * Set the <code>Priority</code> of the request
+ * @param priority <code>Priority</code> of the request
+ */
+ @Public
+ @Stable
+ public abstract void setPriority(Priority priority);
+
+ /**
+ * Get the <em>host/rack</em> on which the allocation is desired.
+ *
+ * A special value of <em>*</em> signifies that <em>any</em> host/rack is
+ * acceptable.
+ *
+ * @return <em>host/rack</em> on which the allocation is desired
+ */
+ @Public
+ @Stable
public abstract String getHostName();
+
+ /**
+ * Set <em>host/rack</em> on which the allocation is desired.
+ *
+ * A special value of <em>*</em> signifies that <em>any</em> host/rack is
+ * acceptable.
+ *
+ * @param hostName <em>host/rack</em> on which the allocation is desired
+ */
+ @Public
+ @Stable
+ public abstract void setHostName(String hostName);
+
+ /**
+ * Get the <code>Resource</code> capability of the request.
+ * @return <code>Resource</code> capability of the request
+ */
+ @Public
+ @Stable
public abstract Resource getCapability();
- public abstract int getNumContainers();
- public abstract void setPriority(Priority priority);
- public abstract void setHostName(String hostName);
+ /**
+ * Set the <code>Resource</code> capability of the request
+ * @param capability <code>Resource</code> capability of the request
+ */
+ @Public
+ @Stable
public abstract void setCapability(Resource capability);
- public abstract void setNumContainers(int numContainers);
-
+ /**
+ * Get the number of containers required with the given specifications.
+ * @return number of containers required with the given specifications
+ */
+ @Public
+ @Stable
+ public abstract int getNumContainers();
+
+ /**
+ * Set the number of containers required with the given specifications
+ * @param numContainers number of containers required with the given
+ * specifications
+ */
+ @Public
+ @Stable
+ public abstract void setNumContainers(int numContainers);
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/URL.java Tue Sep 13 00:05:51 2011
@@ -18,14 +18,77 @@
package org.apache.hadoop.yarn.api.records;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Evolving;
+
+/**
+ * <p><code>URL</code> represents a serializable {@link java.net.URL}.</p>
+ */
+@Public
+@Evolving
public interface URL {
+
+ /**
+ * Get the scheme of the URL.
+ * @return scheme of the URL
+ */
+ @Public
+ @Evolving
public abstract String getScheme();
- public abstract String getHost();
- public abstract int getPort();
- public abstract String getFile();
+ /**
+ * Set the scheme of the URL
+ * @param scheme scheme of the URL
+ */
+ @Public
+ @Evolving
public abstract void setScheme(String scheme);
+
+ /**
+ * Get the host of the URL.
+ * @return host of the URL
+ */
+ @Public
+ @Evolving
+ public abstract String getHost();
+
+ /**
+ * Set the host of the URL.
+ * @param host host of the URL
+ */
+ @Public
+ @Evolving
public abstract void setHost(String host);
+
+ /**
+ * Get the port of the URL.
+ * @return port of the URL
+ */
+ @Public
+ @Evolving
+ public abstract int getPort();
+
+ /**
+ * Set the port of the URL
+ * @param port port of the URL
+ */
+ @Public
+ @Evolving
public abstract void setPort(int port);
+
+ /**
+ * Get the file of the URL.
+ * @return file of the URL
+ */
+ @Public
+ @Evolving
+ public abstract String getFile();
+
+ /**
+ * Set the file of the URL.
+ * @param file file of the URL
+ */
+ @Public
+ @Evolving
public abstract void setFile(String file);
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java Tue Sep 13 00:05:51 2011
@@ -18,10 +18,30 @@
package org.apache.hadoop.yarn.api.records;
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+
+/**
+ * <p><code>YarnClusterMetrics</code> represents cluster metrics.</p>
+ *
+ * <p>Currently only number of <code>NodeManager</code>s is provided.</p>
+ */
+@Public
+@Stable
public interface YarnClusterMetrics {
+ /**
+ * Get the number of <code>NodeManager</code>s in the cluster.
+ * @return number of <code>NodeManager</code>s in the cluster
+ */
+ @Public
+ @Stable
public abstract int getNumNodeManagers();
-
+
+ @Private
+ @Unstable
public abstract void setNumNodeManagers(int numNodeManagers);
}
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerIdPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerIdPBImpl.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerIdPBImpl.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerIdPBImpl.java Tue Sep 13 00:05:51 2011
@@ -19,10 +19,8 @@
package org.apache.hadoop.yarn.api.records.impl.pb;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto;
-import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProtoOrBuilder;
@@ -32,8 +30,7 @@ public class ContainerIdPBImpl extends C
ContainerIdProto.Builder builder = null;
boolean viaProto = false;
- private ApplicationId applicationId = null;
- private ApplicationAttemptId appAttemptId = null;
+ private ApplicationAttemptId applicationAttemptId = null;
public ContainerIdPBImpl() {
builder = ContainerIdProto.newBuilder();
@@ -52,11 +49,10 @@ public class ContainerIdPBImpl extends C
}
private synchronized void mergeLocalToBuilder() {
- if (this.applicationId != null && !((ApplicationIdPBImpl)applicationId).getProto().equals(builder.getAppId())) {
- builder.setAppId(convertToProtoFormat(this.applicationId));
- }
- if (this.appAttemptId != null && !((ApplicationAttemptIdPBImpl)appAttemptId).getProto().equals(builder.getAppAttemptId())) {
- builder.setAppAttemptId(convertToProtoFormat(this.appAttemptId));
+ if (this.applicationAttemptId != null && !
+ ((ApplicationAttemptIdPBImpl)applicationAttemptId).getProto().equals(
+ builder.getAppAttemptId())) {
+ builder.setAppAttemptId(convertToProtoFormat(this.applicationAttemptId));
}
}
@@ -87,61 +83,36 @@ public class ContainerIdPBImpl extends C
maybeInitBuilder();
builder.setId((id));
}
- @Override
- public synchronized ApplicationId getAppId() {
- ContainerIdProtoOrBuilder p = viaProto ? proto : builder;
- if (this.applicationId != null) {
- return this.applicationId;
- }
- if (!p.hasAppId()) {
- return null;
- }
- this.applicationId = convertFromProtoFormat(p.getAppId());
- return this.applicationId;
- }
+
@Override
- public synchronized ApplicationAttemptId getAppAttemptId() {
+ public synchronized ApplicationAttemptId getApplicationAttemptId() {
ContainerIdProtoOrBuilder p = viaProto ? proto : builder;
- if (this.appAttemptId != null) {
- return this.appAttemptId;
+ if (this.applicationAttemptId != null) {
+ return this.applicationAttemptId;
}
if (!p.hasAppAttemptId()) {
return null;
}
- this.appAttemptId = convertFromProtoFormat(p.getAppAttemptId());
- return this.appAttemptId;
+ this.applicationAttemptId = convertFromProtoFormat(p.getAppAttemptId());
+ return this.applicationAttemptId;
}
@Override
- public synchronized void setAppId(ApplicationId appId) {
- maybeInitBuilder();
- if (appId == null)
- builder.clearAppId();
- this.applicationId = appId;
- }
-
- @Override
- public synchronized void setAppAttemptId(ApplicationAttemptId atId) {
+ public synchronized void setApplicationAttemptId(ApplicationAttemptId atId) {
maybeInitBuilder();
if (atId == null)
builder.clearAppAttemptId();
- this.appAttemptId = atId;
+ this.applicationAttemptId = atId;
}
- private ApplicationAttemptIdPBImpl convertFromProtoFormat(ApplicationAttemptIdProto p) {
+ private ApplicationAttemptIdPBImpl convertFromProtoFormat(
+ ApplicationAttemptIdProto p) {
return new ApplicationAttemptIdPBImpl(p);
}
- private ApplicationAttemptIdProto convertToProtoFormat(ApplicationAttemptId t) {
+ private ApplicationAttemptIdProto convertToProtoFormat(
+ ApplicationAttemptId t) {
return ((ApplicationAttemptIdPBImpl)t).getProto();
}
-
- private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) {
- return new ApplicationIdPBImpl(p);
- }
-
- private ApplicationIdProto convertToProtoFormat(ApplicationId t) {
- return ((ApplicationIdPBImpl)t).getProto();
- }
}