Rebase to latest trunk, fix conflicts and pom.xml

This commit is contained in:
Jian He 2017-04-18 14:04:35 +08:00
parent fd9d0d4ead
commit c3ac67e3e1
4 changed files with 23 additions and 8 deletions

View File

@ -182,6 +182,11 @@
<artifactId>hadoop-hdfs</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-client</artifactId>

View File

@ -64,6 +64,7 @@
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.client.api.AMRMClient;
import org.apache.hadoop.yarn.client.api.TimelineClient;
import org.apache.hadoop.yarn.client.api.TimelineV2Client;
import org.apache.hadoop.yarn.client.api.YarnClient;
import org.apache.hadoop.yarn.client.api.async.AMRMClientAsync;
import org.apache.hadoop.yarn.client.api.async.NMClientAsync;
@ -240,7 +241,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
private AMRMClientAsync asyncRMClient;
/** Handle to communicate with the timeline service */
private TimelineClient timelineClient;
private TimelineV2Client timelineClient;
private boolean timelineServiceEnabled = false;
@ -658,8 +659,8 @@ private int createAndRunCluster(String appName) throws Throwable {
deployChildService(asyncRMClient);
if (timelineServiceEnabled) {
timelineClient = TimelineClient.createTimelineClient(appid);
asyncRMClient.registerTimelineClient(timelineClient);
timelineClient = TimelineV2Client.createTimelineClient(appid);
asyncRMClient.registerTimelineV2Client(timelineClient);
timelineClient.init(getConfig());
timelineClient.start();
log.info("Timeline client started.");

View File

@ -32,6 +32,7 @@
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEvent;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric;
import org.apache.hadoop.yarn.client.api.TimelineClient;
import org.apache.hadoop.yarn.client.api.TimelineV2Client;
import org.apache.hadoop.yarn.util.timeline.TimelineUtils;
import org.apache.slider.api.resource.Application;
import org.apache.slider.api.resource.Component;
@ -53,7 +54,7 @@ public class ServiceTimelinePublisher extends CompositeService {
// Number of bytes of config which can be published in one shot to ATSv2.
public static final int ATS_CONFIG_PUBLISH_SIZE_BYTES = 10 * 1024;
private TimelineClient timelineClient;
private TimelineV2Client timelineClient;
private volatile boolean stopped = false;
@ -69,7 +70,7 @@ public boolean isStopped() {
return stopped;
}
public ServiceTimelinePublisher(TimelineClient client) {
public ServiceTimelinePublisher(TimelineV2Client client) {
super(ServiceTimelinePublisher.class.getName());
timelineClient = client;
}

View File

@ -31,11 +31,14 @@
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity.Identifier;
import org.apache.hadoop.yarn.client.api.TimelineClient;
import org.apache.hadoop.yarn.client.api.TimelineV2Client;
import org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl;
import org.apache.hadoop.yarn.client.api.impl.TimelineV2ClientImpl;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.slider.api.resource.Application;
import org.apache.slider.api.resource.ApplicationState;
@ -55,7 +58,7 @@
* Test class for ServiceTimelinePublisher.
*/
public class TestServiceTimelinePublisher {
private TimelineClient timelineClient;
private TimelineV2Client timelineClient;
private Configuration config;
private ServiceTimelinePublisher serviceTimelinePublisher;
private static String SERVICE_NAME = "HBASE";
@ -74,7 +77,8 @@ public class TestServiceTimelinePublisher {
@Before
public void setUp() throws Exception {
config = new Configuration();
timelineClient = new DummyTimelineClient();
timelineClient =
new DummyTimelineClient(ApplicationId.fromString(SERVICEID));
serviceTimelinePublisher = new ServiceTimelinePublisher(timelineClient);
timelineClient.init(config);
serviceTimelinePublisher.init(config);
@ -249,10 +253,14 @@ public static void main(String[] args) {
System.out.println(application.getConfiguration());
}
protected static class DummyTimelineClient extends TimelineClientImpl {
protected static class DummyTimelineClient extends TimelineV2ClientImpl {
private Map<Identifier, TimelineEntity> lastPublishedEntities =
new HashMap<>();
public DummyTimelineClient(ApplicationId appId) {
super(appId);
}
@Override
public void putEntitiesAsync(TimelineEntity... entities)
throws IOException, YarnException {