YARN-7941. Transitive dependencies for component are not resolved. Contributed by Billie Rinaldi.

This commit is contained in:
Rohith Sharma K S 2018-04-11 09:18:50 +05:30
parent d919eb6efa
commit c048711099
2 changed files with 13 additions and 4 deletions

View File

@ -179,6 +179,7 @@ public Component(
maxContainerFailurePerComp = componentSpec.getConfiguration() maxContainerFailurePerComp = componentSpec.getConfiguration()
.getPropertyInt(CONTAINER_FAILURE_THRESHOLD, 10); .getPropertyInt(CONTAINER_FAILURE_THRESHOLD, 10);
createNumCompInstances(component.getNumberOfContainers()); createNumCompInstances(component.getNumberOfContainers());
setDesiredContainers(component.getNumberOfContainers().intValue());
} }
private void createNumCompInstances(long count) { private void createNumCompInstances(long count) {

View File

@ -166,7 +166,9 @@ public void testStopDestroySavedService() throws Exception {
// Create compa with 2 containers // Create compa with 2 containers
// Create compb with 2 containers which depends on compa // Create compb with 2 containers which depends on compa
// Check containers for compa started before containers for compb // Create compc with 2 containers which depends on compb
// Check containers for compa started before containers for compb before
// containers for compc
@Test (timeout = 200000) @Test (timeout = 200000)
public void testComponentStartOrder() throws Exception { public void testComponentStartOrder() throws Exception {
setupInternal(NUM_NMS); setupInternal(NUM_NMS);
@ -175,17 +177,23 @@ public void testComponentStartOrder() throws Exception {
exampleApp.setName("teststartorder"); exampleApp.setName("teststartorder");
exampleApp.setVersion("v1"); exampleApp.setVersion("v1");
exampleApp.addComponent(createComponent("compa", 2, "sleep 1000")); exampleApp.addComponent(createComponent("compa", 2, "sleep 1000"));
Component compb = createComponent("compb", 2, "sleep 1000");
// Let compb depedends on compa; // Let compb depend on compa
Component compb = createComponent("compb", 2, "sleep 1000");
compb.setDependencies(Collections.singletonList("compa")); compb.setDependencies(Collections.singletonList("compa"));
exampleApp.addComponent(compb); exampleApp.addComponent(compb);
// Let compc depend on compb
Component compc = createComponent("compc", 2, "sleep 1000");
compc.setDependencies(Collections.singletonList("compb"));
exampleApp.addComponent(compc);
client.actionCreate(exampleApp); client.actionCreate(exampleApp);
waitForServiceToBeStable(client, exampleApp); waitForServiceToBeStable(client, exampleApp);
// check that containers for compa are launched before containers for compb // check that containers for compa are launched before containers for compb
checkContainerLaunchDependencies(client, exampleApp, "compa", "compb"); checkContainerLaunchDependencies(client, exampleApp, "compa", "compb",
"compc");
client.actionStop(exampleApp.getName(), true); client.actionStop(exampleApp.getName(), true);
client.actionDestroy(exampleApp.getName()); client.actionDestroy(exampleApp.getName());