Package org.springframework.yarn.am.grid.support

Examples of org.springframework.yarn.am.grid.support.ProjectionData


   * @param request the container cluster create request
   * @return the container cluster create response
   */
  @RequestMapping(method = RequestMethod.POST)
  public HttpEntity<Void> createCluster(@RequestBody ContainerClusterCreateRequest request) {
    ProjectionData projectionData = new ProjectionData();
    if (request.getProjectionData().getAny() != null) {
      projectionData.setAny(request.getProjectionData().getAny());
    }
    if (request.getProjectionData().getHosts() != null) {
      projectionData.setHosts(request.getProjectionData().getHosts());
    }
    if (request.getProjectionData().getRacks() != null) {
      projectionData.setRacks(request.getProjectionData().getRacks());
    }

    if (request.getProjection() == null) {
      throw new InvalidInputException("Projection not defined");
    }

    projectionData.setType(request.getProjection().toString().toLowerCase());

    Map<String, Object> extraProperties = request.getExtraProperties();

    delegate.createCluster(request.getClusterId(), request.getClusterDef(), projectionData, extraProperties);

View Full Code Here


  public HttpEntity<Void> updateCluster(@PathVariable("clusterId") String clusterId, @RequestBody ContainerClusterCreateRequest request) {
    ContainerCluster cluster = delegate.getClusters().get(clusterId);
    if (cluster == null) {
      throw new NoSuchClusterException("No such cluster: " + clusterId);
    }
    ProjectionData data = new ProjectionData();
    if (request.getProjectionData().getAny() != null) {
      data.setAny(request.getProjectionData().getAny());
    }
    if (request.getProjectionData().getHosts() != null) {
      data.setHosts(request.getProjectionData().getHosts());
    }
    if (request.getProjectionData().getRacks() != null) {
      data.setRacks(request.getProjectionData().getRacks());
    }
    delegate.modifyCluster(clusterId, data);

    return new ResponseEntity<Void>(HttpStatus.OK);
  }
View Full Code Here

    public ProjectionDataRegistry projectionDataRegistry() {
      Map<String, ProjectionData> projections = new HashMap<String, ProjectionData>();
      Map<String, ContainerClustersProperties> clusterProps = syap.getContainercluster().getClusters();
      if (clusterProps != null) {
        for (java.util.Map.Entry<String, ContainerClustersProperties> entry : clusterProps.entrySet()) {
          ProjectionData data = new ProjectionData(entry.getValue().getProjectionAny(), entry.getValue()
              .getProjectionHosts(), entry.getValue().getProjectionRacks());
          data.setType(entry.getValue().getProjectionType());
          SpringYarnAppmasterResourceProperties resource = entry.getValue().getResource();
          if (resource != null) {
            data.setPriority(resource.getPriority());
          }
          projections.put(entry.getKey(), data);

        }
      }
View Full Code Here

    }

    @Bean
    public ProjectionDataRegistry projectionDataRegistry() {
      Map<String, ProjectionData> defaults = new HashMap<String, ProjectionData>();
      defaults.put("cluster1", new ProjectionData(null, null, null, "any", 0));
      return new ProjectionDataRegistry(defaults);
    }
View Full Code Here

    }

    @Bean
    public ProjectionDataRegistry projectionDataRegistry() {
      Map<String, ProjectionData> defaults = new HashMap<String, ProjectionData>();
      defaults.put("cluster1", new ProjectionData(null, null, null, "any", 0));
      return new ProjectionDataRegistry(defaults);
    }
View Full Code Here

  public void testCreateOneCluster() throws Exception {
    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    ProjectionData projectionData = new ProjectionData(1, null, null, "any", null);
    appmaster.createContainerCluster("cluster", projectionData);
    assertDoTask(appmaster, 0, 0, 0, 0, "foo", true);
  }
View Full Code Here

  public void testCreateStartOneCluster() throws Exception {
    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);
    ProjectionData projectionData = new ProjectionData(1, null, null, "any", null);
    appmaster.createContainerCluster("foo", projectionData);
    appmaster.startContainerCluster("foo");
    assertDoTask(appmaster, 1, 0, 0, 0, "foo");
  }
View Full Code Here

    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    TestManagedContainerClusterAppmaster appmaster = createTestAppmaster(allocator, launcher);
    appmaster.setStateMachineFactory(stateMachineFactory);

    ProjectionData projectionData = new ProjectionData(1, null, null, "any", 0);

    appmaster.createContainerCluster("foo", projectionData);
    appmaster.startContainerCluster("foo");

    // should get 1 any alloc and no container kills
View Full Code Here

  public void testCreateStartStopOneCluster() throws Exception {
    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    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");
View Full Code Here

  public void testCreateStartModifyOneCluster() throws Exception {
    TestContainerAllocator allocator = new TestContainerAllocator();
    TestContainerLauncher launcher = new TestContainerLauncher();
    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);
View Full Code Here

TOP

Related Classes of org.springframework.yarn.am.grid.support.ProjectionData

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.