YARN-6616: YARN AHS shows submitTime for jobs same as startTime. Contributed by Prabhu Joseph

(cherry picked from commit 04105bbfdb)
This commit is contained in:
Eric E Payne 2019-01-29 17:22:24 +00:00
parent 6b8dd8d113
commit 4052b7ee60
10 changed files with 91 additions and 19 deletions

View File

@ -62,6 +62,22 @@ public abstract class ApplicationReport {
FinalApplicationStatus finalStatus, FinalApplicationStatus finalStatus,
ApplicationResourceUsageReport appResources, String origTrackingUrl, ApplicationResourceUsageReport appResources, String origTrackingUrl,
float progress, String applicationType, Token amRmToken) { float progress, String applicationType, Token amRmToken) {
return newInstance(applicationId, applicationAttemptId, user, queue, name,
host, rpcPort, clientToAMToken, state, diagnostics, url,
startTime, startTime, launchTime, finishTime, finalStatus, appResources,
origTrackingUrl, progress, applicationType, amRmToken);
}
@Private
@Unstable
public static ApplicationReport newInstance(ApplicationId applicationId,
ApplicationAttemptId applicationAttemptId, String user, String queue,
String name, String host, int rpcPort, Token clientToAMToken,
YarnApplicationState state, String diagnostics, String url,
long startTime, long submitTime, long launchTime, long finishTime,
FinalApplicationStatus finalStatus,
ApplicationResourceUsageReport appResources, String origTrackingUrl,
float progress, String applicationType, Token amRmToken) {
ApplicationReport report = Records.newRecord(ApplicationReport.class); ApplicationReport report = Records.newRecord(ApplicationReport.class);
report.setApplicationId(applicationId); report.setApplicationId(applicationId);
report.setCurrentApplicationAttemptId(applicationAttemptId); report.setCurrentApplicationAttemptId(applicationAttemptId);
@ -75,6 +91,7 @@ public abstract class ApplicationReport {
report.setDiagnostics(diagnostics); report.setDiagnostics(diagnostics);
report.setTrackingUrl(url); report.setTrackingUrl(url);
report.setStartTime(startTime); report.setStartTime(startTime);
report.setSubmitTime(submitTime);
report.setLaunchTime(launchTime); report.setLaunchTime(launchTime);
report.setFinishTime(finishTime); report.setFinishTime(finishTime);
report.setFinalApplicationStatus(finalStatus); report.setFinalApplicationStatus(finalStatus);
@ -102,7 +119,7 @@ public abstract class ApplicationReport {
ApplicationReport report = ApplicationReport report =
newInstance(applicationId, applicationAttemptId, user, queue, name, newInstance(applicationId, applicationAttemptId, user, queue, name,
host, rpcPort, clientToAMToken, state, diagnostics, url, host, rpcPort, clientToAMToken, state, diagnostics, url,
startTime, 0, finishTime, finalStatus, appResources, startTime, 0, 0, finishTime, finalStatus, appResources,
origTrackingUrl, progress, applicationType, amRmToken); origTrackingUrl, progress, applicationType, amRmToken);
report.setApplicationTags(tags); report.setApplicationTags(tags);
report.setUnmanagedApp(unmanagedApplication); report.setUnmanagedApp(unmanagedApplication);
@ -124,10 +141,30 @@ public abstract class ApplicationReport {
float progress, String applicationType, Token amRmToken, Set<String> tags, float progress, String applicationType, Token amRmToken, Set<String> tags,
boolean unmanagedApplication, Priority priority, boolean unmanagedApplication, Priority priority,
String appNodeLabelExpression, String amNodeLabelExpression) { String appNodeLabelExpression, String amNodeLabelExpression) {
return newInstance(applicationId, applicationAttemptId, user, queue, name,
host, rpcPort, clientToAMToken, state, diagnostics, url,
startTime, startTime, launchTime, finishTime, finalStatus, appResources,
origTrackingUrl, progress, applicationType, amRmToken, tags,
unmanagedApplication, priority, appNodeLabelExpression,
amNodeLabelExpression);
}
@Private
@Unstable
public static ApplicationReport newInstance(ApplicationId applicationId,
ApplicationAttemptId applicationAttemptId, String user, String queue,
String name, String host, int rpcPort, Token clientToAMToken,
YarnApplicationState state, String diagnostics, String url,
long startTime, long submitTime, long launchTime, long finishTime,
FinalApplicationStatus finalStatus,
ApplicationResourceUsageReport appResources, String origTrackingUrl,
float progress, String applicationType, Token amRmToken, Set<String> tags,
boolean unmanagedApplication, Priority priority,
String appNodeLabelExpression, String amNodeLabelExpression) {
ApplicationReport report = ApplicationReport report =
newInstance(applicationId, applicationAttemptId, user, queue, name, newInstance(applicationId, applicationAttemptId, user, queue, name,
host, rpcPort, clientToAMToken, state, diagnostics, url, startTime, host, rpcPort, clientToAMToken, state, diagnostics, url, startTime,
launchTime, finishTime, finalStatus, appResources, submitTime, launchTime, finishTime, finalStatus, appResources,
origTrackingUrl, progress, applicationType, amRmToken); origTrackingUrl, progress, applicationType, amRmToken);
report.setApplicationTags(tags); report.setApplicationTags(tags);
report.setUnmanagedApp(unmanagedApplication); report.setUnmanagedApp(unmanagedApplication);
@ -311,6 +348,14 @@ public abstract class ApplicationReport {
@Unstable @Unstable
public abstract void setStartTime(long startTime); public abstract void setStartTime(long startTime);
@Public
@Stable
public abstract long getSubmitTime();
@Private
@Unstable
public abstract void setSubmitTime(long submitTime);
@Private @Private
@Unstable @Unstable
public abstract void setLaunchTime(long setLaunchTime); public abstract void setLaunchTime(long setLaunchTime);

View File

@ -282,6 +282,7 @@ message ApplicationReportProto {
optional string amNodeLabelExpression = 25; optional string amNodeLabelExpression = 25;
repeated AppTimeoutsMapProto appTimeouts = 26; repeated AppTimeoutsMapProto appTimeouts = 26;
optional int64 launchTime = 27; optional int64 launchTime = 27;
optional int64 submitTime = 28;
} }
message AppTimeoutsMapProto { message AppTimeoutsMapProto {

View File

@ -102,6 +102,8 @@ public class TestAHSClient {
Assert.assertEquals(report, expectedReports.get(0)); Assert.assertEquals(report, expectedReports.get(0));
Assert.assertEquals(report.getApplicationId().toString(), expectedReports Assert.assertEquals(report.getApplicationId().toString(), expectedReports
.get(0).getApplicationId().toString()); .get(0).getApplicationId().toString());
Assert.assertEquals(report.getSubmitTime(), expectedReports.get(0)
.getSubmitTime());
client.stop(); client.stop();
} }
@ -332,7 +334,7 @@ public class TestAHSClient {
ApplicationReport.newInstance(applicationId, ApplicationReport.newInstance(applicationId,
ApplicationAttemptId.newInstance(applicationId, 1), "user", ApplicationAttemptId.newInstance(applicationId, 1), "user",
"queue", "appname", "host", 124, null, "queue", "appname", "host", 124, null,
YarnApplicationState.RUNNING, "diagnostics", "url", 0, 0, 0, YarnApplicationState.RUNNING, "diagnostics", "url", 1, 2, 3, 4,
FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.53789f, "YARN", FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.53789f, "YARN",
null); null);
List<ApplicationReport> applicationReports = List<ApplicationReport> applicationReports =

View File

@ -220,6 +220,12 @@ public class ApplicationReportPBImpl extends ApplicationReport {
return p.getStartTime(); return p.getStartTime();
} }
@Override
public long getSubmitTime() {
ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
return p.getSubmitTime();
}
@Override @Override
public long getLaunchTime() { public long getLaunchTime() {
ApplicationReportProtoOrBuilder p = viaProto ? proto : builder; ApplicationReportProtoOrBuilder p = viaProto ? proto : builder;
@ -430,6 +436,12 @@ public class ApplicationReportPBImpl extends ApplicationReport {
builder.setFinishTime(finishTime); builder.setFinishTime(finishTime);
} }
@Override
public void setSubmitTime(long submitTime) {
maybeInitBuilder();
builder.setSubmitTime(submitTime);
}
@Override @Override
public void setFinalApplicationStatus(FinalApplicationStatus finishState) { public void setFinalApplicationStatus(FinalApplicationStatus finishState) {
maybeInitBuilder(); maybeInitBuilder();

View File

@ -137,9 +137,9 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
currentApplicationAttemptId, appHistory.getUser(), appHistory.getQueue(), currentApplicationAttemptId, appHistory.getUser(), appHistory.getQueue(),
appHistory.getApplicationName(), host, rpcPort, null, appHistory.getApplicationName(), host, rpcPort, null,
appHistory.getYarnApplicationState(), appHistory.getDiagnosticsInfo(), appHistory.getYarnApplicationState(), appHistory.getDiagnosticsInfo(),
trackingUrl, appHistory.getStartTime(), 0, appHistory.getFinishTime(), trackingUrl, appHistory.getStartTime(), appHistory.getSubmitTime(), 0,
appHistory.getFinalApplicationStatus(), null, "", 100, appHistory.getFinishTime(), appHistory.getFinalApplicationStatus(),
appHistory.getApplicationType(), null); null, "", 100, appHistory.getApplicationType(), null);
} }
private ApplicationAttemptHistoryData getLastAttempt(ApplicationId appId) private ApplicationAttemptHistoryData getLastAttempt(ApplicationId appId)

View File

@ -250,6 +250,7 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
String type = null; String type = null;
boolean unmanagedApplication = false; boolean unmanagedApplication = false;
long createdTime = 0; long createdTime = 0;
long submittedTime = 0;
long finishedTime = 0; long finishedTime = 0;
float progress = 0.0f; float progress = 0.0f;
int applicationPriority = 0; int applicationPriority = 0;
@ -281,10 +282,11 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
return new ApplicationReportExt(ApplicationReport.newInstance( return new ApplicationReportExt(ApplicationReport.newInstance(
ApplicationId.fromString(entity.getEntityId()), ApplicationId.fromString(entity.getEntityId()),
latestApplicationAttemptId, user, queue, name, null, -1, null, latestApplicationAttemptId, user, queue, name, null, -1, null,
state, diagnosticsInfo, null, createdTime, finishedTime, state, diagnosticsInfo, null, createdTime, submittedTime, 0,
finalStatus, null, null, progress, type, null, appTags, finishedTime, finalStatus, null, null, progress, type, null,
unmanagedApplication, Priority.newInstance(applicationPriority), appTags, unmanagedApplication, Priority.newInstance(
appNodeLabelExpression, amNodeLabelExpression), appViewACLs); applicationPriority), appNodeLabelExpression,
amNodeLabelExpression), appViewACLs);
} }
if (entityInfo.containsKey(ApplicationMetricsConstants.QUEUE_ENTITY_INFO)) { if (entityInfo.containsKey(ApplicationMetricsConstants.QUEUE_ENTITY_INFO)) {
queue = queue =
@ -329,6 +331,8 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
entityInfo.get(ApplicationMetricsConstants.AM_NODE_LABEL_EXPRESSION) entityInfo.get(ApplicationMetricsConstants.AM_NODE_LABEL_EXPRESSION)
.toString(); .toString();
} }
submittedTime = parseLong(entityInfo,
ApplicationMetricsConstants.SUBMITTED_TIME_ENTITY_INFO);
if (entityInfo.containsKey(ApplicationMetricsConstants.APP_CPU_METRICS)) { if (entityInfo.containsKey(ApplicationMetricsConstants.APP_CPU_METRICS)) {
long vcoreSeconds = parseLong(entityInfo, long vcoreSeconds = parseLong(entityInfo,
@ -450,10 +454,10 @@ public class ApplicationHistoryManagerOnTimelineStore extends AbstractService
return new ApplicationReportExt(ApplicationReport.newInstance( return new ApplicationReportExt(ApplicationReport.newInstance(
ApplicationId.fromString(entity.getEntityId()), ApplicationId.fromString(entity.getEntityId()),
latestApplicationAttemptId, user, queue, name, null, -1, null, state, latestApplicationAttemptId, user, queue, name, null, -1, null, state,
diagnosticsInfo, null, createdTime, finishedTime, finalStatus, diagnosticsInfo, null, createdTime, submittedTime, 0, finishedTime,
appResources, null, progress, type, null, appTags, unmanagedApplication, finalStatus, appResources, null, progress, type, null, appTags,
Priority.newInstance(applicationPriority), appNodeLabelExpression, unmanagedApplication, Priority.newInstance(applicationPriority),
amNodeLabelExpression), appViewACLs); appNodeLabelExpression, amNodeLabelExpression), appViewACLs);
} }
private static long parseLong(Map<String, Object> entityInfo, private static long parseLong(Map<String, Object> entityInfo,

View File

@ -214,6 +214,7 @@ public class TestApplicationHistoryManagerOnTimelineStore {
} }
Assert.assertEquals(Integer.MAX_VALUE + 2L Assert.assertEquals(Integer.MAX_VALUE + 2L
+ app.getApplicationId().getId(), app.getStartTime()); + app.getApplicationId().getId(), app.getStartTime());
Assert.assertEquals(Integer.MAX_VALUE + 1L, app.getSubmitTime());
Assert.assertEquals(Integer.MAX_VALUE + 3L Assert.assertEquals(Integer.MAX_VALUE + 3L
+ +app.getApplicationId().getId(), app.getFinishTime()); + +app.getApplicationId().getId(), app.getFinishTime());
Assert.assertTrue(Math.abs(app.getProgress() - 1.0F) < 0.0001); Assert.assertTrue(Math.abs(app.getProgress() - 1.0F) < 0.0001);

View File

@ -407,6 +407,7 @@ public class TestAHSWebServices extends JerseyTestBase {
assertEquals("test app", app.get("name")); assertEquals("test app", app.get("name"));
assertEquals(round == 0 ? "test diagnostics info" : "", assertEquals(round == 0 ? "test diagnostics info" : "",
app.get("diagnosticsInfo")); app.get("diagnosticsInfo"));
assertEquals(Integer.MAX_VALUE + 1L, app.get("submittedTime"));
assertEquals("test queue", app.get("queue")); assertEquals("test queue", app.get("queue"));
assertEquals("user1", app.get("user")); assertEquals("user1", app.get("user"));
assertEquals("test app type", app.get("type")); assertEquals("test app type", app.get("type"));

View File

@ -53,7 +53,7 @@ public class AppInfo {
protected String originalTrackingUrl; protected String originalTrackingUrl;
protected String trackingUrl; protected String trackingUrl;
protected FinalApplicationStatus finalAppStatus; protected FinalApplicationStatus finalAppStatus;
protected long submittedTime; private long submittedTime;
protected long startedTime; protected long startedTime;
private long launchTime; private long launchTime;
protected long finishedTime; protected long finishedTime;
@ -87,7 +87,7 @@ public class AppInfo {
diagnosticsInfo = app.getDiagnostics(); diagnosticsInfo = app.getDiagnostics();
trackingUrl = app.getTrackingUrl(); trackingUrl = app.getTrackingUrl();
originalTrackingUrl = app.getOriginalTrackingUrl(); originalTrackingUrl = app.getOriginalTrackingUrl();
submittedTime = app.getStartTime(); submittedTime = app.getSubmitTime();
startedTime = app.getStartTime(); startedTime = app.getStartTime();
launchTime = app.getLaunchTime(); launchTime = app.getLaunchTime();
finishedTime = app.getFinishTime(); finishedTime = app.getFinishTime();

View File

@ -288,6 +288,7 @@ public abstract class MockAsm extends MockApps {
final String name = newAppName(); final String name = newAppName();
final String queue = newQueue(); final String queue = newQueue();
final long start = 123456 + i * 1000; final long start = 123456 + i * 1000;
final long submit = start + i * 50;
final long launch = start + i * 100; final long launch = start + i * 100;
final long finish = 234567 + i * 1000; final long finish = 234567 + i * 1000;
final String type = YarnConfiguration.DEFAULT_APPLICATION_TYPE; final String type = YarnConfiguration.DEFAULT_APPLICATION_TYPE;
@ -324,6 +325,11 @@ public abstract class MockAsm extends MockApps {
return start; return start;
} }
@Override
public long getSubmitTime() {
return submit;
}
@Override @Override
public long getLaunchTime() { public long getLaunchTime() {
return launch; return launch;
@ -379,9 +385,9 @@ public abstract class MockAsm extends MockApps {
ApplicationReport report = ApplicationReport.newInstance( ApplicationReport report = ApplicationReport.newInstance(
getApplicationId(), appAttemptId, getUser(), getQueue(), getApplicationId(), appAttemptId, getUser(), getQueue(),
getName(), null, 0, null, null, getDiagnostics().toString(), getName(), null, 0, null, null, getDiagnostics().toString(),
getTrackingUrl(), getLaunchTime(), getStartTime(), getFinishTime(), getTrackingUrl(), getStartTime(), getSubmitTime(), getLaunchTime(),
getFinalApplicationStatus(), usageReport , null, getProgress(), getFinishTime(), getFinalApplicationStatus(), usageReport, null,
type, null); getProgress(), type, null);
return report; return report;
} }