YARN-6446. Revisit ATSv2 integration to ensure all required information is published. Contributed by Rohith Sharma K S
This commit is contained in:
parent
08cdf231a0
commit
a8a273b064
|
@ -28,6 +28,7 @@ import org.apache.slider.core.exceptions.SliderException;
|
||||||
import org.apache.slider.core.launch.ContainerLauncher;
|
import org.apache.slider.core.launch.ContainerLauncher;
|
||||||
import org.apache.slider.server.appmaster.state.RoleInstance;
|
import org.apache.slider.server.appmaster.state.RoleInstance;
|
||||||
import org.apache.slider.server.appmaster.state.StateAccessForProviders;
|
import org.apache.slider.server.appmaster.state.StateAccessForProviders;
|
||||||
|
import org.apache.slider.server.appmaster.timelineservice.ServiceTimelinePublisher;
|
||||||
import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
|
import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -57,4 +58,11 @@ public interface ProviderService extends Service {
|
||||||
*/
|
*/
|
||||||
boolean processContainerStatus(ContainerId containerId,
|
boolean processContainerStatus(ContainerId containerId,
|
||||||
ContainerStatus status);
|
ContainerStatus status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set service publisher.
|
||||||
|
* @param serviceTimelinePublisher service publisher.
|
||||||
|
*/
|
||||||
|
void setServiceTimelinePublisher(
|
||||||
|
ServiceTimelinePublisher serviceTimelinePublisher);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.slider.providers.ProviderService;
|
||||||
import org.apache.slider.providers.ProviderUtils;
|
import org.apache.slider.providers.ProviderUtils;
|
||||||
import org.apache.slider.server.appmaster.state.RoleInstance;
|
import org.apache.slider.server.appmaster.state.RoleInstance;
|
||||||
import org.apache.slider.server.appmaster.state.StateAccessForProviders;
|
import org.apache.slider.server.appmaster.state.StateAccessForProviders;
|
||||||
|
import org.apache.slider.server.appmaster.timelineservice.ServiceTimelinePublisher;
|
||||||
import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
|
import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -57,6 +58,7 @@ public class DockerProviderService extends AbstractService
|
||||||
private static final String QUICK_LINKS = "quicklinks";
|
private static final String QUICK_LINKS = "quicklinks";
|
||||||
protected StateAccessForProviders amState;
|
protected StateAccessForProviders amState;
|
||||||
protected YarnRegistryViewForProviders yarnRegistry;
|
protected YarnRegistryViewForProviders yarnRegistry;
|
||||||
|
private ServiceTimelinePublisher serviceTimelinePublisher;
|
||||||
|
|
||||||
protected DockerProviderService() {
|
protected DockerProviderService() {
|
||||||
super("DockerProviderService");
|
super("DockerProviderService");
|
||||||
|
@ -126,6 +128,9 @@ public class DockerProviderService extends AbstractService
|
||||||
PublishedConfiguration pubconf = new PublishedConfiguration(QUICK_LINKS,
|
PublishedConfiguration pubconf = new PublishedConfiguration(QUICK_LINKS,
|
||||||
application.getQuicklinks().entrySet());
|
application.getQuicklinks().entrySet());
|
||||||
amState.getPublishedSliderConfigurations().put(QUICK_LINKS, pubconf);
|
amState.getPublishedSliderConfigurations().put(QUICK_LINKS, pubconf);
|
||||||
|
if (serviceTimelinePublisher != null) {
|
||||||
|
serviceTimelinePublisher.serviceAttemptUpdated(application);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean processContainerStatus(ContainerId containerId,
|
public boolean processContainerStatus(ContainerId containerId,
|
||||||
|
@ -155,4 +160,9 @@ public class DockerProviderService extends AbstractService
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setServiceTimelinePublisher(ServiceTimelinePublisher publisher) {
|
||||||
|
this.serviceTimelinePublisher = publisher;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -661,11 +661,13 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
||||||
asyncRMClient.registerTimelineV2Client(timelineClient);
|
asyncRMClient.registerTimelineV2Client(timelineClient);
|
||||||
timelineClient.init(getConfig());
|
timelineClient.init(getConfig());
|
||||||
timelineClient.start();
|
timelineClient.start();
|
||||||
log.info("Timeline client started.");
|
log.info("Timeline v2 client started.");
|
||||||
|
|
||||||
serviceTimelinePublisher = new ServiceTimelinePublisher(timelineClient);
|
serviceTimelinePublisher = new ServiceTimelinePublisher(timelineClient);
|
||||||
serviceTimelinePublisher.init(getConfig());
|
serviceTimelinePublisher.init(getConfig());
|
||||||
serviceTimelinePublisher.start();
|
serviceTimelinePublisher.start();
|
||||||
|
|
||||||
|
providerService.setServiceTimelinePublisher(serviceTimelinePublisher);
|
||||||
appState.setServiceTimelinePublisher(serviceTimelinePublisher);
|
appState.setServiceTimelinePublisher(serviceTimelinePublisher);
|
||||||
log.info("ServiceTimelinePublisher started.");
|
log.info("ServiceTimelinePublisher started.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.apache.hadoop.service.CompositeService;
|
||||||
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.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.TimelineV2Client;
|
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;
|
||||||
|
@ -109,6 +108,13 @@ public class ServiceTimelinePublisher extends CompositeService {
|
||||||
publishComponents(application.getComponents());
|
publishComponents(application.getComponents());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void serviceAttemptUpdated(Application application) {
|
||||||
|
TimelineEntity entity = createServiceAttemptEntity(application.getId());
|
||||||
|
entity.addInfo(SliderTimelineMetricsConstants.QUICK_LINKS,
|
||||||
|
application.getQuicklinks());
|
||||||
|
putEntity(entity);
|
||||||
|
}
|
||||||
|
|
||||||
public void serviceAttemptUnregistered(AppState appState,
|
public void serviceAttemptUnregistered(AppState appState,
|
||||||
ActionStopSlider stopAction) {
|
ActionStopSlider stopAction) {
|
||||||
long currentTimeMillis = System.currentTimeMillis();
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
|
|
|
@ -37,6 +37,8 @@ public final class SliderTimelineMetricsConstants {
|
||||||
|
|
||||||
public static final String LAUNCH_TIME = "LAUNCH_TIME";
|
public static final String LAUNCH_TIME = "LAUNCH_TIME";
|
||||||
|
|
||||||
|
public static final String QUICK_LINKS = "QUICK_LINKS";
|
||||||
|
|
||||||
public static final String LAUNCH_COMMAND = "LAUNCH_COMMAND";
|
public static final String LAUNCH_COMMAND = "LAUNCH_COMMAND";
|
||||||
|
|
||||||
public static final String TOTAL_CONTAINERS = "NUMBER_OF_CONTAINERS";
|
public static final String TOTAL_CONTAINERS = "NUMBER_OF_CONTAINERS";
|
||||||
|
|
|
@ -23,10 +23,9 @@ 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.TimelineV2Client;
|
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.client.api.impl.TimelineV2ClientImpl;
|
||||||
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||||
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;
|
||||||
|
@ -77,6 +76,8 @@ public class TestServiceTimelinePublisher {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
config = new Configuration();
|
config = new Configuration();
|
||||||
|
config.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
|
||||||
|
config.setFloat(YarnConfiguration.TIMELINE_SERVICE_VERSION, 2.0f);
|
||||||
timelineClient =
|
timelineClient =
|
||||||
new DummyTimelineClient(ApplicationId.fromString(SERVICEID));
|
new DummyTimelineClient(ApplicationId.fromString(SERVICEID));
|
||||||
serviceTimelinePublisher = new ServiceTimelinePublisher(timelineClient);
|
serviceTimelinePublisher = new ServiceTimelinePublisher(timelineClient);
|
||||||
|
@ -88,9 +89,13 @@ public class TestServiceTimelinePublisher {
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
|
if (serviceTimelinePublisher != null) {
|
||||||
serviceTimelinePublisher.stop();
|
serviceTimelinePublisher.stop();
|
||||||
|
}
|
||||||
|
if (timelineClient != null) {
|
||||||
timelineClient.stop();
|
timelineClient.stop();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testServiceAttemptEntity() {
|
public void testServiceAttemptEntity() {
|
||||||
|
@ -264,6 +269,12 @@ public class TestServiceTimelinePublisher {
|
||||||
@Override
|
@Override
|
||||||
public void putEntitiesAsync(TimelineEntity... entities)
|
public void putEntitiesAsync(TimelineEntity... entities)
|
||||||
throws IOException, YarnException {
|
throws IOException, YarnException {
|
||||||
|
putEntities(entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void putEntities(TimelineEntity... entities)
|
||||||
|
throws IOException, YarnException {
|
||||||
for (TimelineEntity timelineEntity : entities) {
|
for (TimelineEntity timelineEntity : entities) {
|
||||||
TimelineEntity entity =
|
TimelineEntity entity =
|
||||||
lastPublishedEntities.get(timelineEntity.getIdentifier());
|
lastPublishedEntities.get(timelineEntity.getIdentifier());
|
||||||
|
|
Loading…
Reference in New Issue