Package io.druid.indexing.overlord.setup

Examples of io.druid.indexing.overlord.setup.WorkerSetupData


  @Override
  public AutoScalingData provision()
  {
    try {
      final WorkerSetupData setupData = workerSetupDataRef.get();
      final EC2NodeData workerConfig = setupData.getNodeData();
      final String userDataBase64;

      if (setupData.getUserData() == null) {
        userDataBase64 = null;
      } else {
        if (config.getWorkerVersion() == null) {
          userDataBase64 = setupData.getUserData().getUserDataBase64();
        } else {
          userDataBase64 = setupData.getUserData().withVersion(config.getWorkerVersion()).getUserDataBase64();
        }
      }

      final RunInstancesResult result = amazonEC2Client.runInstances(
          new RunInstancesRequest(
              workerConfig.getAmiId(),
              workerConfig.getMinInstances(),
              workerConfig.getMaxInstances()
          )
              .withInstanceType(workerConfig.getInstanceType())
              .withSecurityGroupIds(workerConfig.getSecurityGroupIds())
              .withPlacement(new Placement(setupData.getAvailabilityZone()))
              .withKeyName(workerConfig.getKeyName())
              .withUserData(userDataBase64)
      );

      final List<String> instanceIds = Lists.transform(
View Full Code Here


  @Override
  public boolean doProvision(Collection<RemoteTaskRunnerWorkItem> pendingTasks, Collection<ZkWorker> zkWorkers)
  {
    synchronized (lock) {
      boolean didProvision = false;
      final WorkerSetupData workerSetupData = workerSetupDataRef.get();
      if (workerSetupData == null) {
        log.warn("No workerSetupData available, cannot provision new workers.");
        return false;
      }
      final Predicate<ZkWorker> isValidWorker = createValidWorkerPredicate(config, workerSetupData);
View Full Code Here

  @Override
  public boolean doTerminate(Collection<RemoteTaskRunnerWorkItem> pendingTasks, Collection<ZkWorker> zkWorkers)
  {
    synchronized (lock) {
      final WorkerSetupData workerSetupData = workerSetupDataRef.get();
      if (workerSetupData == null) {
        log.warn("No workerSetupData available, cannot terminate workers.");
        return false;
      }
View Full Code Here

  @Before
  public void setUp() throws Exception
  {
    autoScalingStrategy = EasyMock.createMock(AutoScalingStrategy.class);
    workerSetupData = new AtomicReference<>(
        new WorkerSetupData(
            0, 2, null, null, null
        )
    );

    testTask = new TestMergeTask(
View Full Code Here

  }

  @Test
  public void testDoSuccessfulTerminate() throws Exception
  {
    workerSetupData.set(new WorkerSetupData(0, 1, null, null, null));

    EasyMock.expect(autoScalingStrategy.ipToIdLookup(EasyMock.<List<String>>anyObject()))
            .andReturn(Lists.<String>newArrayList());
    EasyMock.expect(autoScalingStrategy.terminate(EasyMock.<List<String>>anyObject())).andReturn(
        new AutoScalingData(Lists.<String>newArrayList())
View Full Code Here

  }

  @Test
  public void testSomethingTerminating() throws Exception
  {
    workerSetupData.set(new WorkerSetupData(0, 1, null, null, null));

    EasyMock.expect(autoScalingStrategy.ipToIdLookup(EasyMock.<List<String>>anyObject()))
            .andReturn(Lists.<String>newArrayList("ip")).times(2);
    EasyMock.expect(autoScalingStrategy.terminate(EasyMock.<List<String>>anyObject())).andReturn(
        new AutoScalingData(Lists.<String>newArrayList("ip"))
View Full Code Here

    );
    Assert.assertFalse(provisionedSomething);
    EasyMock.verify(autoScalingStrategy);

    // Increase minNumWorkers
    workerSetupData.set(new WorkerSetupData(3, 5, null, null, null));

    // Should provision two new workers
    EasyMock.reset(autoScalingStrategy);
    EasyMock.expect(autoScalingStrategy.ipToIdLookup(EasyMock.<List<String>>anyObject()))
            .andReturn(Lists.<String>newArrayList("ip"));
View Full Code Here

  @Test
  public void testScale()
  {
    workerSetupData.set(
        new WorkerSetupData(
            0,
            1,
            "",
            new EC2NodeData(AMI_ID, INSTANCE_ID, 1, 1, Lists.<String>newArrayList(), "foo"),
            new GalaxyEC2UserData(new DefaultObjectMapper(), "env", "version", "type")
View Full Code Here

TOP

Related Classes of io.druid.indexing.overlord.setup.WorkerSetupData

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.