MAPREDUCE-2796. Set start times for MR applications for clients to see. Contributed by Devaraj K.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1161704 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7c85f33ce1
commit
1dd113b24a
@ -1143,6 +1143,9 @@ Trunk (unreleased changes)
|
|||||||
MAPREDUCE-2877. Add missing Apache license header in some files in MR
|
MAPREDUCE-2877. Add missing Apache license header in some files in MR
|
||||||
and also add the rat plugin to the poms. (mahadev)
|
and also add the rat plugin to the poms. (mahadev)
|
||||||
|
|
||||||
|
MAPREDUCE-2796. Set start times for MR applications for clients to see.
|
||||||
|
(Devaraj K via acmurthy)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -409,6 +409,7 @@ public static JobStatus fromYarn(ApplicationReport application) {
|
|||||||
application.getQueue(), "", trackingUrl
|
application.getQueue(), "", trackingUrl
|
||||||
);
|
);
|
||||||
jobStatus.setSchedulingInfo(trackingUrl); // Set AM tracking url
|
jobStatus.setSchedulingInfo(trackingUrl); // Set AM tracking url
|
||||||
|
jobStatus.setStartTime(application.getStartTime());
|
||||||
return jobStatus;
|
return jobStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.apache.hadoop.mapreduce;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ApplicationState;
|
||||||
|
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
|
||||||
|
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationReportPBImpl;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class TestTypeConverter {
|
||||||
|
@Test
|
||||||
|
public void testFromYarn() throws Exception {
|
||||||
|
int appStartTime = 612354;
|
||||||
|
ApplicationState state = ApplicationState.RUNNING;
|
||||||
|
ApplicationId applicationId = new ApplicationIdPBImpl();
|
||||||
|
ApplicationReportPBImpl applicationReport = new ApplicationReportPBImpl();
|
||||||
|
applicationReport.setApplicationId(applicationId);
|
||||||
|
applicationReport.setState(state);
|
||||||
|
applicationReport.setStartTime(appStartTime);
|
||||||
|
JobStatus jobStatus = TypeConverter.fromYarn(applicationReport);
|
||||||
|
Assert.assertEquals(appStartTime, jobStatus.getStartTime());
|
||||||
|
Assert.assertEquals(state.toString(), jobStatus.getState().toString());
|
||||||
|
}
|
||||||
|
}
|
@ -49,4 +49,7 @@ public interface ApplicationReport {
|
|||||||
|
|
||||||
String getTrackingUrl();
|
String getTrackingUrl();
|
||||||
void setTrackingUrl(String url);
|
void setTrackingUrl(String url);
|
||||||
|
|
||||||
|
long getStartTime();
|
||||||
|
void setStartTime(long startTime);
|
||||||
}
|
}
|
||||||
|
@ -279,4 +279,16 @@ private ApplicationIdPBImpl convertFromProtoFormat(
|
|||||||
ApplicationIdProto applicationId) {
|
ApplicationIdProto applicationId) {
|
||||||
return new ApplicationIdPBImpl(applicationId);
|
return new ApplicationIdPBImpl(applicationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getStartTime() {
|
||||||
|
ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
|
||||||
|
return p.getStartTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStartTime(long startTime) {
|
||||||
|
maybeInitBuilder();
|
||||||
|
builder.setStartTime(startTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,6 +139,7 @@ message ApplicationReportProto {
|
|||||||
optional ContainerProto masterContainer = 10;
|
optional ContainerProto masterContainer = 10;
|
||||||
optional string trackingUrl = 11;
|
optional string trackingUrl = 11;
|
||||||
optional string diagnostics = 12 [default = "N/A"];
|
optional string diagnostics = 12 [default = "N/A"];
|
||||||
|
optional int64 startTime = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
message NodeIdProto {
|
message NodeIdProto {
|
||||||
|
@ -211,7 +211,7 @@ public static ResourceRequest newResourceRequest(ResourceRequest r) {
|
|||||||
public static ApplicationReport newApplicationReport(
|
public static ApplicationReport newApplicationReport(
|
||||||
ApplicationId applicationId, String user, String queue, String name,
|
ApplicationId applicationId, String user, String queue, String name,
|
||||||
String host, int rpcPort, String clientToken, ApplicationState state,
|
String host, int rpcPort, String clientToken, ApplicationState state,
|
||||||
String diagnostics, String url) {
|
String diagnostics, String url, long startTime) {
|
||||||
ApplicationReport report = recordFactory
|
ApplicationReport report = recordFactory
|
||||||
.newRecordInstance(ApplicationReport.class);
|
.newRecordInstance(ApplicationReport.class);
|
||||||
report.setApplicationId(applicationId);
|
report.setApplicationId(applicationId);
|
||||||
@ -224,6 +224,7 @@ public static ApplicationReport newApplicationReport(
|
|||||||
report.setState(state);
|
report.setState(state);
|
||||||
report.setDiagnostics(diagnostics);
|
report.setDiagnostics(diagnostics);
|
||||||
report.setTrackingUrl(url);
|
report.setTrackingUrl(url);
|
||||||
|
report.setStartTime(startTime);
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,18 @@ public void setClientToken(String clientToken) {
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getStartTime() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStartTime(long startTime) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ public ApplicationReport createAndGetApplicationReport() {
|
|||||||
return BuilderUtils.newApplicationReport(this.applicationId, this.user,
|
return BuilderUtils.newApplicationReport(this.applicationId, this.user,
|
||||||
this.queue, this.name, host, rpcPort, clientToken,
|
this.queue, this.name, host, rpcPort, clientToken,
|
||||||
createApplicationState(this.stateMachine.getCurrentState()),
|
createApplicationState(this.stateMachine.getCurrentState()),
|
||||||
this.diagnostics.toString(), trackingUrl);
|
this.diagnostics.toString(), trackingUrl, this.startTime);
|
||||||
} finally {
|
} finally {
|
||||||
this.readLock.unlock();
|
this.readLock.unlock();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user