Package org.springframework.yarn.am.grid

Examples of org.springframework.yarn.am.grid.GridProjection


    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    ProjectionData projectionData = new ProjectionData(1, null, null, "any", 0);

    // create
    GridProjection projection = appmaster.createContainerCluster("foo", projectionData).getGridProjection();
    assertDoTask(appmaster, null, null, null, null, "foo");

    // start
    appmaster.startContainerCluster("foo");
    assertDoTask(appmaster, 1, 0, 0, 0, "foo");

    // allocate container 1
    allocateContainer(appmaster, 1);
    assertThat(projection.getMembers().size(), is(1));
    assertDoTask(appmaster, null, null, null, null, "foo");

    // stop
    appmaster.resetTestData();
    appmaster.stopContainerCluster("foo");
View Full Code Here


    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    ProjectionData projectionData = new ProjectionData(1, null, null, "any", 0);

    // create
    GridProjection projection = appmaster.createContainerCluster("foo", projectionData).getGridProjection();
    assertDoTask(appmaster, null, null, null, null, "foo");

    // start
    appmaster.startContainerCluster("foo");
    assertDoTask(appmaster, 1, 0, 0, 0, "foo");

    // allocate container 1
    Container container1 = allocateContainer(appmaster, 1);
    assertThat(projection.getMembers().size(), is(1));
    assertDoTask(appmaster, null, null, null, null, "foo");

    // modify - ramp up to 2
    appmaster.modifyContainerCluster("foo", new ProjectionData(2));
    assertDoTask(appmaster, 1, 0, 0, 0, "foo");

    // allocate container 2
    allocateContainer(appmaster, 2);
    assertThat(projection.getMembers().size(), is(2));
    assertDoTask(appmaster, null, null, null, null, "foo");

    // modify - ramp up to 4
    appmaster.modifyContainerCluster("foo", new ProjectionData(4));
    assertDoTask(appmaster, 2, 0, 0, 0, "foo");

    // allocate container 3 and 4
    allocateContainer(appmaster, 3);
    allocateContainer(appmaster, 4);
    assertThat(projection.getMembers().size(), is(4));
    assertDoTask(appmaster, null, null, null, null, "foo");

    releaseContainer(appmaster, container1);
    assertThat(projection.getMembers().size(), is(3));
    assertDoTask(appmaster, 1, 0, 0, 0, "foo");
  }
View Full Code Here

    if (gridProjectionFactory == null) {
      throw new IllegalArgumentException("Projection type " + projectionData.getType()
          + " not know to gridProjectionFactoryLocator=[" + gridProjectionFactoryLocator + "]");
    }

    GridProjection projection = gridProjectionFactory.getGridProjection(projectionData);
    if (projection == null) {
      throw new IllegalArgumentException("Unable to build projection using type " + projectionData.getType());
    }

    ProjectionData p = projectionDataRegistry.getProjectionDatas().get(clusterDef);
View Full Code Here

    ContainerCluster cluster = headers.get("containercluster", ContainerCluster.class);
    ProjectionData projectionData = headers.get("projectiondata", ProjectionData.class);
    AbstractContainerClusterAppmaster appmaster = headers.get("appmaster", AbstractContainerClusterAppmaster.class);

    if(projectionData != null) {
      GridProjection gridProjection = cluster.getGridProjection();
      gridProjection.setProjectionData(projectionData);
    }

    if (cluster != null) {
      SatisfyStateData satisfyData = cluster.getGridProjection().getSatisfyState();
      if (satisfyData != null) {
View Full Code Here

  public DefaultGridProjectionFactory() {
  }

  @Override
  public GridProjection getGridProjection(ProjectionData projectionData) {
    GridProjection projection = null;
    if ("hosts".equalsIgnoreCase(projectionData.getType())) {
      HostsGridProjection p = new HostsGridProjection();
      p.setPriority(projectionData.getPriority());
      projection = p;
    } else if ("racks".equalsIgnoreCase(projectionData.getType())) {
      RacksGridProjection p = new RacksGridProjection();
      p.setPriority(projectionData.getPriority());
      projection = p;
    } else if ("any".equalsIgnoreCase(projectionData.getType())) {
      AnyGridProjection p = new AnyGridProjection();
      p.setPriority(projectionData.getPriority());
      projection = p;
    }
    if (projection != null) {
      projection.setProjectionData(projectionData);
    }
    return projection;
  }
View Full Code Here

TOP

Related Classes of org.springframework.yarn.am.grid.GridProjection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.