|
@@ -64,7 +64,6 @@ import org.apache.hadoop.yarn.api.records.NodeState;
|
|
import org.apache.hadoop.yarn.api.records.Priority;
|
|
import org.apache.hadoop.yarn.api.records.Priority;
|
|
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.TimelineV2Client;
|
|
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;
|
|
@@ -342,7 +341,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
* ProviderService of this cluster
|
|
* ProviderService of this cluster
|
|
*/
|
|
*/
|
|
@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
|
|
@SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
|
|
- private ProviderService providerService;
|
|
|
|
|
|
+ private List<ProviderService> providers = new ArrayList<>();
|
|
|
|
|
|
/**
|
|
/**
|
|
* The YARN registry service
|
|
* The YARN registry service
|
|
@@ -523,8 +522,6 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
public Configuration bindArgs(Configuration config, String... args) throws Exception {
|
|
public Configuration bindArgs(Configuration config, String... args) throws Exception {
|
|
// let the superclass process it
|
|
// let the superclass process it
|
|
Configuration superConf = super.bindArgs(config, args);
|
|
Configuration superConf = super.bindArgs(config, args);
|
|
- // add the slider XML config
|
|
|
|
- ConfigHelper.injectSliderXMLResource();
|
|
|
|
|
|
|
|
//yarn-ify
|
|
//yarn-ify
|
|
YarnConfiguration yarnConfiguration = new YarnConfiguration(
|
|
YarnConfiguration yarnConfiguration = new YarnConfiguration(
|
|
@@ -603,12 +600,15 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
// obtain security state
|
|
// obtain security state
|
|
// set the global security flag for the instance definition
|
|
// set the global security flag for the instance definition
|
|
|
|
|
|
- //get our provider
|
|
|
|
- SliderProviderFactory factory =
|
|
|
|
- SliderProviderFactory.createSliderProviderFactory("docker");
|
|
|
|
- providerService = factory.createServerProvider();
|
|
|
|
- // init the provider BUT DO NOT START IT YET
|
|
|
|
- initAndAddService(providerService);
|
|
|
|
|
|
+ // initialize our providers
|
|
|
|
+ for (Component component : application.getComponents()) {
|
|
|
|
+ SliderProviderFactory factory = SliderProviderFactory
|
|
|
|
+ .createSliderProviderFactory(component.getArtifact());
|
|
|
|
+ ProviderService providerService = factory.createServerProvider();
|
|
|
|
+ // init the provider BUT DO NOT START IT YET
|
|
|
|
+ initAndAddService(providerService);
|
|
|
|
+ providers.add(providerService);
|
|
|
|
+ }
|
|
|
|
|
|
InetSocketAddress rmSchedulerAddress = SliderUtils.getRmSchedulerAddress(serviceConf);
|
|
InetSocketAddress rmSchedulerAddress = SliderUtils.getRmSchedulerAddress(serviceConf);
|
|
log.info("RM is at {}", rmSchedulerAddress);
|
|
log.info("RM is at {}", rmSchedulerAddress);
|
|
@@ -667,7 +667,9 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
serviceTimelinePublisher.init(getConfig());
|
|
serviceTimelinePublisher.init(getConfig());
|
|
serviceTimelinePublisher.start();
|
|
serviceTimelinePublisher.start();
|
|
|
|
|
|
- providerService.setServiceTimelinePublisher(serviceTimelinePublisher);
|
|
|
|
|
|
+ for (ProviderService providerService : providers) {
|
|
|
|
+ providerService.setServiceTimelinePublisher(serviceTimelinePublisher);
|
|
|
|
+ }
|
|
appState.setServiceTimelinePublisher(serviceTimelinePublisher);
|
|
appState.setServiceTimelinePublisher(serviceTimelinePublisher);
|
|
log.info("ServiceTimelinePublisher started.");
|
|
log.info("ServiceTimelinePublisher started.");
|
|
}
|
|
}
|
|
@@ -707,7 +709,7 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
WebAppApiImpl webAppApi =
|
|
WebAppApiImpl webAppApi =
|
|
new WebAppApiImpl(
|
|
new WebAppApiImpl(
|
|
stateForProviders,
|
|
stateForProviders,
|
|
- providerService, registryOperations,
|
|
|
|
|
|
+ registryOperations,
|
|
metricsAndMonitoring,
|
|
metricsAndMonitoring,
|
|
actionQueues);
|
|
actionQueues);
|
|
initAMFilterOptions(serviceConf);
|
|
initAMFilterOptions(serviceConf);
|
|
@@ -843,13 +845,14 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
|
|
|
|
//launcher service
|
|
//launcher service
|
|
launchService = new RoleLaunchService(actionQueues,
|
|
launchService = new RoleLaunchService(actionQueues,
|
|
- providerService,
|
|
|
|
fs, envVars);
|
|
fs, envVars);
|
|
|
|
|
|
deployChildService(launchService);
|
|
deployChildService(launchService);
|
|
|
|
|
|
//Give the provider access to the state, and AM
|
|
//Give the provider access to the state, and AM
|
|
- providerService.setAMState(stateForProviders);
|
|
|
|
|
|
+ for (ProviderService providerService : providers) {
|
|
|
|
+ providerService.setAMState(stateForProviders);
|
|
|
|
+ }
|
|
|
|
|
|
// chaos monkey
|
|
// chaos monkey
|
|
maybeStartMonkey();
|
|
maybeStartMonkey();
|
|
@@ -1119,7 +1122,9 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
SliderKeys.APP_TYPE,
|
|
SliderKeys.APP_TYPE,
|
|
instanceName,
|
|
instanceName,
|
|
appAttemptID);
|
|
appAttemptID);
|
|
- providerService.bindToYarnRegistry(yarnRegistryOperations);
|
|
|
|
|
|
+ for (ProviderService providerService : providers) {
|
|
|
|
+ providerService.bindToYarnRegistry(yarnRegistryOperations);
|
|
|
|
+ }
|
|
|
|
|
|
// Yarn registry
|
|
// Yarn registry
|
|
ServiceRecord serviceRecord = new ServiceRecord();
|
|
ServiceRecord serviceRecord = new ServiceRecord();
|
|
@@ -1859,7 +1864,9 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
protected synchronized void launchProviderService()
|
|
protected synchronized void launchProviderService()
|
|
throws IOException, SliderException {
|
|
throws IOException, SliderException {
|
|
// didn't start, so don't register
|
|
// didn't start, so don't register
|
|
- providerService.start();
|
|
|
|
|
|
+ for (ProviderService providerService : providers) {
|
|
|
|
+ providerService.start();
|
|
|
|
+ }
|
|
// and send the started event ourselves
|
|
// and send the started event ourselves
|
|
eventCallbackEvent(null);
|
|
eventCallbackEvent(null);
|
|
}
|
|
}
|
|
@@ -1959,19 +1966,23 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
ContainerStatus containerStatus) {
|
|
ContainerStatus containerStatus) {
|
|
LOG_YARN.debug("Container Status: id={}, status={}", containerId,
|
|
LOG_YARN.debug("Container Status: id={}, status={}", containerId,
|
|
containerStatus);
|
|
containerStatus);
|
|
|
|
+ RoleInstance cinfo = appState.getOwnedContainer(containerId);
|
|
|
|
+ if (cinfo == null) {
|
|
|
|
+ LOG_YARN.error("Owned container not found for {}", containerId);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ ProviderService providerService = SliderProviderFactory
|
|
|
|
+ .getProviderService(cinfo.providerRole.component.getArtifact());
|
|
if (providerService.processContainerStatus(containerId, containerStatus)) {
|
|
if (providerService.processContainerStatus(containerId, containerStatus)) {
|
|
try {
|
|
try {
|
|
Thread.sleep(1000);
|
|
Thread.sleep(1000);
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
}
|
|
}
|
|
- RoleInstance cinfo = appState.getOwnedContainer(containerId);
|
|
|
|
- if (cinfo != null) {
|
|
|
|
- LOG_YARN.info("Re-requesting status for role {}, {}",
|
|
|
|
- cinfo.role, containerId);
|
|
|
|
- //trigger another async container status
|
|
|
|
- nmClientAsync.getContainerStatusAsync(containerId,
|
|
|
|
- cinfo.container.getNodeId());
|
|
|
|
- }
|
|
|
|
|
|
+ LOG_YARN.info("Re-requesting status for role {}, {}",
|
|
|
|
+ cinfo.role, containerId);
|
|
|
|
+ //trigger another async container status
|
|
|
|
+ nmClientAsync.getContainerStatusAsync(containerId,
|
|
|
|
+ cinfo.container.getNodeId());
|
|
} else if (timelineServiceEnabled) {
|
|
} else if (timelineServiceEnabled) {
|
|
RoleInstance instance = appState.getOwnedContainer(containerId);
|
|
RoleInstance instance = appState.getOwnedContainer(containerId);
|
|
if (instance != null) {
|
|
if (instance != null) {
|
|
@@ -1997,11 +2008,6 @@ public class SliderAppMaster extends AbstractSliderLaunchedService
|
|
LOG_YARN.warn("Failed to stop Container {}", containerId);
|
|
LOG_YARN.warn("Failed to stop Container {}", containerId);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- public ProviderService getProviderService() {
|
|
|
|
- return providerService;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Queue an action for immediate execution in the executor thread
|
|
* Queue an action for immediate execution in the executor thread
|
|
* @param action action to execute
|
|
* @param action action to execute
|