|
@@ -82,7 +82,7 @@ public class TimelineClientImpl extends TimelineClient {
|
|
@VisibleForTesting
|
|
@VisibleForTesting
|
|
protected String doAsUser;
|
|
protected String doAsUser;
|
|
|
|
|
|
- private float timelineServiceVersion;
|
|
|
|
|
|
+ private boolean timelineServiceV15Enabled;
|
|
private TimelineWriter timelineWriter;
|
|
private TimelineWriter timelineWriter;
|
|
|
|
|
|
private String timelineServiceAddress;
|
|
private String timelineServiceAddress;
|
|
@@ -96,15 +96,15 @@ public class TimelineClientImpl extends TimelineClient {
|
|
}
|
|
}
|
|
|
|
|
|
protected void serviceInit(Configuration conf) throws Exception {
|
|
protected void serviceInit(Configuration conf) throws Exception {
|
|
- timelineServiceVersion =
|
|
|
|
- conf.getFloat(YarnConfiguration.TIMELINE_SERVICE_VERSION,
|
|
|
|
- YarnConfiguration.DEFAULT_TIMELINE_SERVICE_VERSION);
|
|
|
|
if (!YarnConfiguration.timelineServiceV1Enabled(conf)) {
|
|
if (!YarnConfiguration.timelineServiceV1Enabled(conf)) {
|
|
throw new IOException("Timeline V1 client is not properly configured. "
|
|
throw new IOException("Timeline V1 client is not properly configured. "
|
|
+ "Either timeline service is not enabled or version is not set to"
|
|
+ "Either timeline service is not enabled or version is not set to"
|
|
+ " 1.x");
|
|
+ " 1.x");
|
|
}
|
|
}
|
|
- LOG.info("Timeline service address: " + getTimelineServiceAddress());
|
|
|
|
|
|
+
|
|
|
|
+ timelineServiceV15Enabled =
|
|
|
|
+ YarnConfiguration.timelineServiceV15Enabled(conf);
|
|
|
|
+
|
|
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
|
|
UserGroupInformation realUgi = ugi.getRealUser();
|
|
UserGroupInformation realUgi = ugi.getRealUser();
|
|
if (realUgi != null) {
|
|
if (realUgi != null) {
|
|
@@ -126,6 +126,7 @@ public class TimelineClientImpl extends TimelineClient {
|
|
conf.get(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
|
|
conf.get(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS,
|
|
YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS);
|
|
YarnConfiguration.DEFAULT_TIMELINE_SERVICE_WEBAPP_ADDRESS);
|
|
}
|
|
}
|
|
|
|
+ LOG.info("Timeline service address: " + getTimelineServiceAddress());
|
|
super.serviceInit(conf);
|
|
super.serviceInit(conf);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -147,7 +148,7 @@ public class TimelineClientImpl extends TimelineClient {
|
|
protected TimelineWriter createTimelineWriter(Configuration conf,
|
|
protected TimelineWriter createTimelineWriter(Configuration conf,
|
|
UserGroupInformation ugi, Client webClient, URI uri)
|
|
UserGroupInformation ugi, Client webClient, URI uri)
|
|
throws IOException {
|
|
throws IOException {
|
|
- if (Float.compare(this.timelineServiceVersion, 1.5f) == 0) {
|
|
|
|
|
|
+ if (timelineServiceV15Enabled) {
|
|
return new FileSystemTimelineWriter(
|
|
return new FileSystemTimelineWriter(
|
|
conf, ugi, webClient, uri);
|
|
conf, ugi, webClient, uri);
|
|
} else {
|
|
} else {
|
|
@@ -406,10 +407,9 @@ public class TimelineClientImpl extends TimelineClient {
|
|
public TimelinePutResponse putEntities(ApplicationAttemptId appAttemptId,
|
|
public TimelinePutResponse putEntities(ApplicationAttemptId appAttemptId,
|
|
TimelineEntityGroupId groupId, TimelineEntity... entities)
|
|
TimelineEntityGroupId groupId, TimelineEntity... entities)
|
|
throws IOException, YarnException {
|
|
throws IOException, YarnException {
|
|
- if (Float.compare(this.timelineServiceVersion, 1.5f) != 0) {
|
|
|
|
|
|
+ if (!timelineServiceV15Enabled) {
|
|
throw new YarnException(
|
|
throw new YarnException(
|
|
- "This API is not supported under current Timeline Service Version: "
|
|
|
|
- + timelineServiceVersion);
|
|
|
|
|
|
+ "This API is not supported under current Timeline Service Version:");
|
|
}
|
|
}
|
|
|
|
|
|
return timelineWriter.putEntities(appAttemptId, groupId, entities);
|
|
return timelineWriter.putEntities(appAttemptId, groupId, entities);
|
|
@@ -418,10 +418,9 @@ public class TimelineClientImpl extends TimelineClient {
|
|
@Override
|
|
@Override
|
|
public void putDomain(ApplicationAttemptId appAttemptId,
|
|
public void putDomain(ApplicationAttemptId appAttemptId,
|
|
TimelineDomain domain) throws IOException, YarnException {
|
|
TimelineDomain domain) throws IOException, YarnException {
|
|
- if (Float.compare(this.timelineServiceVersion, 1.5f) != 0) {
|
|
|
|
|
|
+ if (!timelineServiceV15Enabled) {
|
|
throw new YarnException(
|
|
throw new YarnException(
|
|
- "This API is not supported under current Timeline Service Version: "
|
|
|
|
- + timelineServiceVersion);
|
|
|
|
|
|
+ "This API is not supported under current Timeline Service Version:");
|
|
}
|
|
}
|
|
timelineWriter.putDomain(appAttemptId, domain);
|
|
timelineWriter.putDomain(appAttemptId, domain);
|
|
}
|
|
}
|