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> <artifactId>hadoop-hdfs</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs-client</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.hadoop</groupId> <groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-yarn-client</artifactId> <artifactId>hadoop-yarn-client</artifactId>

View File

@ -64,6 +64,7 @@
import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.client.api.AMRMClient; import org.apache.hadoop.yarn.client.api.AMRMClient;
import org.apache.hadoop.yarn.client.api.TimelineClient; 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.YarnClient;
import org.apache.hadoop.yarn.client.api.async.AMRMClientAsync; import org.apache.hadoop.yarn.client.api.async.AMRMClientAsync;
import org.apache.hadoop.yarn.client.api.async.NMClientAsync; import org.apache.hadoop.yarn.client.api.async.NMClientAsync;
@ -240,7 +241,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
private AMRMClientAsync asyncRMClient; private AMRMClientAsync asyncRMClient;
/** Handle to communicate with the timeline service */ /** Handle to communicate with the timeline service */
private TimelineClient timelineClient; private TimelineV2Client timelineClient;
private boolean timelineServiceEnabled = false; private boolean timelineServiceEnabled = false;
@ -658,8 +659,8 @@ private int createAndRunCluster(String appName) throws Throwable {
deployChildService(asyncRMClient); deployChildService(asyncRMClient);
if (timelineServiceEnabled) { if (timelineServiceEnabled) {
timelineClient = TimelineClient.createTimelineClient(appid); timelineClient = TimelineV2Client.createTimelineClient(appid);
asyncRMClient.registerTimelineClient(timelineClient); asyncRMClient.registerTimelineV2Client(timelineClient);
timelineClient.init(getConfig()); timelineClient.init(getConfig());
timelineClient.start(); timelineClient.start();
log.info("Timeline client started."); 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.TimelineEvent;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric;
import org.apache.hadoop.yarn.client.api.TimelineClient; 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.hadoop.yarn.util.timeline.TimelineUtils;
import org.apache.slider.api.resource.Application; import org.apache.slider.api.resource.Application;
import org.apache.slider.api.resource.Component; 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. // 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; public static final int ATS_CONFIG_PUBLISH_SIZE_BYTES = 10 * 1024;
private TimelineClient timelineClient; private TimelineV2Client timelineClient;
private volatile boolean stopped = false; private volatile boolean stopped = false;
@ -69,7 +70,7 @@ public boolean isStopped() {
return stopped; return stopped;
} }
public ServiceTimelinePublisher(TimelineClient client) { public ServiceTimelinePublisher(TimelineV2Client client) {
super(ServiceTimelinePublisher.class.getName()); super(ServiceTimelinePublisher.class.getName());
timelineClient = client; timelineClient = client;
} }

View File

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