Skip to content

Commit cf2b24c

Browse files
committed
YARN-918. Remove ApplicationAttemptId from RegisterApplicationMasterRequestProto. Contributed by Vinod K V.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1504735 13f79535-47bb-0310-9956-ffa450edef68
1 parent 01dcefa commit cf2b24c

File tree

29 files changed

+170
-464
lines changed

29 files changed

+170
-464
lines changed

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/local/LocalContainerAllocator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ protected void serviceInit(Configuration conf) throws Exception {
9393
@SuppressWarnings("unchecked")
9494
@Override
9595
protected synchronized void heartbeat() throws Exception {
96-
AllocateRequest allocateRequest = AllocateRequest.newInstance(
97-
this.applicationAttemptId, this.lastResponseID, super
98-
.getApplicationProgress(), new ArrayList<ResourceRequest>(),
96+
AllocateRequest allocateRequest =
97+
AllocateRequest.newInstance(this.lastResponseID,
98+
super.getApplicationProgress(), new ArrayList<ResourceRequest>(),
9999
new ArrayList<ContainerId>(), null);
100100
AllocateResponse allocateResponse;
101101
try {
@@ -143,7 +143,7 @@ public void handle(ContainerAllocatorEvent event) {
143143
LOG.info("Processing the event " + event.toString());
144144
// Assign the same container ID as the AM
145145
ContainerId cID =
146-
ContainerId.newInstance(applicationAttemptId,
146+
ContainerId.newInstance(getContext().getApplicationAttemptId(),
147147
this.containerId.getId());
148148
Container container = recordFactory.newRecordInstance(Container.class);
149149
container.setId(cID);

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMCommunicator.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
4646
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
4747
import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
48-
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
4948
import org.apache.hadoop.yarn.api.records.ApplicationId;
5049
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
5150
import org.apache.hadoop.yarn.api.records.Resource;
@@ -63,7 +62,6 @@ public abstract class RMCommunicator extends AbstractService
6362
private static final Log LOG = LogFactory.getLog(RMContainerAllocator.class);
6463
private int rmPollInterval;//millis
6564
protected ApplicationId applicationId;
66-
protected ApplicationAttemptId applicationAttemptId;
6765
private final AtomicBoolean stopped;
6866
protected Thread allocatorThread;
6967
@SuppressWarnings("rawtypes")
@@ -91,7 +89,6 @@ public RMCommunicator(ClientService clientService, AppContext context) {
9189
this.context = context;
9290
this.eventHandler = context.getEventHandler();
9391
this.applicationId = context.getApplicationID();
94-
this.applicationAttemptId = context.getApplicationAttemptId();
9592
this.stopped = new AtomicBoolean(false);
9693
this.heartbeatCallbacks = new ConcurrentLinkedQueue<Runnable>();
9794
}
@@ -142,7 +139,6 @@ protected void register() {
142139
try {
143140
RegisterApplicationMasterRequest request =
144141
recordFactory.newRecordInstance(RegisterApplicationMasterRequest.class);
145-
request.setApplicationAttemptId(applicationAttemptId);
146142
if (serviceAddr != null) {
147143
request.setHost(serviceAddr.getHostName());
148144
request.setRpcPort(serviceAddr.getPort());
@@ -193,11 +189,8 @@ protected void unregister() {
193189
LOG.info("History url is " + historyUrl);
194190

195191
FinishApplicationMasterRequest request =
196-
recordFactory.newRecordInstance(FinishApplicationMasterRequest.class);
197-
request.setAppAttemptId(this.applicationAttemptId);
198-
request.setFinalApplicationStatus(finishState);
199-
request.setDiagnostics(sb.toString());
200-
request.setTrackingUrl(historyUrl);
192+
FinishApplicationMasterRequest.newInstance(finishState,
193+
sb.toString(), historyUrl);
201194
scheduler.finishApplicationMaster(request);
202195
} catch(Exception are) {
203196
LOG.error("Exception while unregistering ", are);

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerAllocator.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,14 +1160,6 @@ boolean remove(TaskAttemptId tId) {
11601160
TaskAttemptId get(ContainerId cId) {
11611161
return containerToAttemptMap.get(cId);
11621162
}
1163-
1164-
NodeId getNodeId(TaskAttemptId tId) {
1165-
if (tId.getTaskId().getTaskType().equals(TaskType.MAP)) {
1166-
return maps.get(tId).getNodeId();
1167-
} else {
1168-
return reduces.get(tId).getNodeId();
1169-
}
1170-
}
11711163

11721164
ContainerId get(TaskAttemptId tId) {
11731165
Container taskContainer;

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/rm/RMContainerRequestor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ protected void serviceInit(Configuration conf) throws Exception {
145145
}
146146

147147
protected AllocateResponse makeRemoteRequest() throws IOException {
148-
AllocateRequest allocateRequest = AllocateRequest.newInstance(
149-
applicationAttemptId, lastResponseID, super.getApplicationProgress(),
150-
new ArrayList<ResourceRequest>(ask), new ArrayList<ContainerId>(
151-
release), null);
148+
AllocateRequest allocateRequest =
149+
AllocateRequest.newInstance(lastResponseID,
150+
super.getApplicationProgress(), new ArrayList<ResourceRequest>(ask),
151+
new ArrayList<ContainerId>(release), null);
152152
AllocateResponse allocateResponse;
153153
try {
154154
allocateResponse = scheduler.allocate(allocateRequest);

hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/MRAppBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public AllocateResponse allocate(AllocateRequest request)
234234
for (int i = 0; i < numContainers; i++) {
235235
ContainerId containerId =
236236
ContainerId.newInstance(
237-
request.getApplicationAttemptId(),
237+
getContext().getApplicationAttemptId(),
238238
request.getResponseId() + i);
239239
containers.add(Container.newInstance(containerId,
240240
NodeId.newInstance("host" + containerId.getId(), 2345),

hadoop-yarn-project/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ Release 2.1.0-beta - 2013-07-02
256256
YARN-701. Use application tokens irrespective of secure or non-secure
257257
mode. (vinodkv via acmurthy)
258258

259+
YARN-918. Remove ApplicationAttemptId from
260+
RegisterApplicationMasterRequestProto. (vinodkv via acmurthy)
261+
259262
NEW FEATURES
260263

261264
YARN-482. FS: Extend SchedulingMode to intermediate queues.

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323
import org.apache.hadoop.classification.InterfaceAudience.Public;
2424
import org.apache.hadoop.classification.InterfaceStability.Stable;
2525
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
26-
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
27-
import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
2826
import org.apache.hadoop.yarn.api.records.Container;
2927
import org.apache.hadoop.yarn.api.records.ContainerId;
28+
import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
3029
import org.apache.hadoop.yarn.api.records.ResourceRequest;
3130
import org.apache.hadoop.yarn.util.Records;
3231

@@ -36,10 +35,6 @@
3635
*
3736
* <p>The request includes:
3837
* <ul>
39-
* <li>
40-
* {@link ApplicationAttemptId} being managed by the
41-
* <code>ApplicationMaster</code>
42-
* </li>
4338
* <li>A response id to track duplicate responses.</li>
4439
* <li>Progress information.</li>
4540
* <li>
@@ -61,41 +56,19 @@ public abstract class AllocateRequest {
6156

6257
@Public
6358
@Stable
64-
public static AllocateRequest newInstance(
65-
ApplicationAttemptId applicationAttemptId, int responseID,
66-
float appProgress, List<ResourceRequest> resourceAsk,
67-
List<ContainerId> containersToBeReleased,
59+
public static AllocateRequest newInstance(int responseID, float appProgress,
60+
List<ResourceRequest> resourceAsk,
61+
List<ContainerId> containersToBeReleased,
6862
ResourceBlacklistRequest resourceBlacklistRequest) {
6963
AllocateRequest allocateRequest = Records.newRecord(AllocateRequest.class);
70-
allocateRequest.setApplicationAttemptId(applicationAttemptId);
7164
allocateRequest.setResponseId(responseID);
7265
allocateRequest.setProgress(appProgress);
7366
allocateRequest.setAskList(resourceAsk);
7467
allocateRequest.setReleaseList(containersToBeReleased);
7568
allocateRequest.setResourceBlacklistRequest(resourceBlacklistRequest);
7669
return allocateRequest;
7770
}
78-
79-
/**
80-
* Get the <code>ApplicationAttemptId</code> being managed by the
81-
* <code>ApplicationMaster</code>.
82-
* @return <code>ApplicationAttemptId</code> being managed by the
83-
* <code>ApplicationMaster</code>
84-
*/
85-
@Public
86-
@Stable
87-
public abstract ApplicationAttemptId getApplicationAttemptId();
8871

89-
/**
90-
* Set the <code>ApplicationAttemptId</code> being managed by the
91-
* <code>ApplicationMaster</code>.
92-
* @param applicationAttemptId <code>ApplicationAttemptId</code> being managed
93-
* by the <code>ApplicationMaster</code>
94-
*/
95-
@Public
96-
@Stable
97-
public abstract void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId);
98-
9972
/**
10073
* Get the <em>response id</em> used to track duplicate responses.
10174
* @return <em>response id</em>

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterRequest.java

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.hadoop.classification.InterfaceAudience.Public;
2222
import org.apache.hadoop.classification.InterfaceStability.Stable;
2323
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
24-
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
2524
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
2625
import org.apache.hadoop.yarn.util.Records;
2726

@@ -31,10 +30,6 @@
3130
*
3231
* <p>The final request includes details such:
3332
* <ul>
34-
* <li>
35-
* {@link ApplicationAttemptId} being managed by the
36-
* <code>ApplicationMaster</code>
37-
* </li>
3833
* <li>Final state of the <code>ApplicationMaster</code></li>
3934
* <li>
4035
* Diagnostic information in case of failure of the
@@ -53,37 +48,15 @@ public abstract class FinishApplicationMasterRequest {
5348
@Public
5449
@Stable
5550
public static FinishApplicationMasterRequest newInstance(
56-
ApplicationAttemptId appAttemptId, FinalApplicationStatus finalAppStatus,
57-
String diagnostics, String url) {
51+
FinalApplicationStatus finalAppStatus, String diagnostics, String url) {
5852
FinishApplicationMasterRequest request =
5953
Records.newRecord(FinishApplicationMasterRequest.class);
60-
request.setAppAttemptId(appAttemptId);
6154
request.setFinalApplicationStatus(finalAppStatus);
6255
request.setDiagnostics(diagnostics);
6356
request.setTrackingUrl(url);
6457
return request;
6558
}
6659

67-
/**
68-
* Get the <code>ApplicationAttemptId</code> being managed by the
69-
* <code>ApplicationMaster</code>.
70-
* @return <code>ApplicationAttemptId</code> being managed by the
71-
* <code>ApplicationMaster</code>
72-
*/
73-
@Public
74-
@Stable
75-
public abstract ApplicationAttemptId getApplicationAttemptId();
76-
77-
/**
78-
* Set the <code>ApplicationAttemptId</code> being managed by the
79-
* <code>ApplicationMaster</code>.
80-
* @param applicationAttemptId <code>ApplicationAttemptId</code> being managed
81-
* by the <code>ApplicationMaster</code>
82-
*/
83-
@Public
84-
@Stable
85-
public abstract void setAppAttemptId(ApplicationAttemptId applicationAttemptId);
86-
8760
/**
8861
* Get <em>final state</em> of the <code>ApplicationMaster</code>.
8962
* @return <em>final state</em> of the <code>ApplicationMaster</code>

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterRequest.java

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.hadoop.classification.InterfaceAudience.Public;
2222
import org.apache.hadoop.classification.InterfaceStability.Stable;
2323
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
24-
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
2524
import org.apache.hadoop.yarn.util.Records;
2625

2726
/**
@@ -30,10 +29,6 @@
3029
*
3130
* <p>The registration includes details such as:
3231
* <ul>
33-
* <li>
34-
* {@link ApplicationAttemptId} being managed by the
35-
* <code>ApplicationMaster</code>
36-
* </li>
3732
* <li>Hostname on which the AM is running.</li>
3833
* <li>RPC Port</li>
3934
* <li>Tracking URL</li>
@@ -57,38 +52,16 @@ public abstract class RegisterApplicationMasterRequest {
5752
*/
5853
@Public
5954
@Stable
60-
public static RegisterApplicationMasterRequest newInstance(
61-
ApplicationAttemptId applicationAttemptId, String host, int port,
62-
String trackingUrl) {
55+
public static RegisterApplicationMasterRequest newInstance(String host,
56+
int port, String trackingUrl) {
6357
RegisterApplicationMasterRequest request =
6458
Records.newRecord(RegisterApplicationMasterRequest.class);
65-
request.setApplicationAttemptId(applicationAttemptId);
6659
request.setHost(host);
6760
request.setRpcPort(port);
6861
request.setTrackingUrl(trackingUrl);
6962
return request;
7063
}
7164

72-
/**
73-
* Get the <code>ApplicationAttemptId</code> being managed by the
74-
* <code>ApplicationMaster</code>.
75-
* @return <code>ApplicationAttemptId</code> being managed by the
76-
* <code>ApplicationMaster</code>
77-
*/
78-
@Public
79-
@Stable
80-
public abstract ApplicationAttemptId getApplicationAttemptId();
81-
82-
/**
83-
* Set the <code>ApplicationAttemptId</code> being managed by the
84-
* <code>ApplicationMaster</code>.
85-
* @param applicationAttemptId <code>ApplicationAttemptId</code> being managed
86-
* by the <code>ApplicationMaster</code>
87-
*/
88-
@Public
89-
@Stable
90-
public abstract void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId);
91-
9265
/**
9366
* Get the <em>host</em> on which the <code>ApplicationMaster</code> is
9467
* running.

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ import "yarn_protos.proto";
3434
/////// AM_RM_Protocol ///////////////////////////////
3535
//////////////////////////////////////////////////////
3636
message RegisterApplicationMasterRequestProto {
37-
optional ApplicationAttemptIdProto application_attempt_id = 1;
38-
optional string host = 2;
39-
optional int32 rpc_port = 3;
40-
optional string tracking_url = 4;
37+
optional string host = 1;
38+
optional int32 rpc_port = 2;
39+
optional string tracking_url = 3;
4140
}
4241

4342
message RegisterApplicationMasterResponseProto {
@@ -47,22 +46,20 @@ message RegisterApplicationMasterResponseProto {
4746
}
4847

4948
message FinishApplicationMasterRequestProto {
50-
optional ApplicationAttemptIdProto application_attempt_id = 1;
51-
optional string diagnostics = 2;
52-
optional string tracking_url = 3;
53-
optional FinalApplicationStatusProto final_application_status = 4;
49+
optional string diagnostics = 1;
50+
optional string tracking_url = 2;
51+
optional FinalApplicationStatusProto final_application_status = 3;
5452
}
5553

5654
message FinishApplicationMasterResponseProto {
5755
}
5856

5957
message AllocateRequestProto {
60-
optional ApplicationAttemptIdProto application_attempt_id = 1;
61-
repeated ResourceRequestProto ask = 2;
62-
repeated ContainerIdProto release = 3;
63-
optional ResourceBlacklistRequestProto blacklist_request = 4;
64-
optional int32 response_id = 5;
65-
optional float progress = 6;
58+
repeated ResourceRequestProto ask = 1;
59+
repeated ContainerIdProto release = 2;
60+
optional ResourceBlacklistRequestProto blacklist_request = 3;
61+
optional int32 response_id = 4;
62+
optional float progress = 5;
6663
}
6764

6865
message NMTokenProto {

0 commit comments

Comments
 (0)