Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
71bf232
Support different types of MiddleManagers by Autoscaler #8695
Nov 4, 2019
22f7529
Support different types of MiddleManagers by Autoscaler #8695
Nov 6, 2019
b61fee9
Support different types of MiddleManagers by Autoscaler #8695
Nov 6, 2019
66d3ebe
Support different types of MiddleManagers by Autoscaler #8695
Nov 6, 2019
ba88a3c
Support different types of MiddleManagers by Autoscaler #8695
Nov 7, 2019
d929a4e
Support different types of MiddleManagers by Autoscaler #8695
Nov 8, 2019
66f63cc
Support different types of MiddleManagers by Autoscaler #8695
Nov 12, 2019
320f0c2
Support different types of MiddleManagers by Autoscaler #8695
Nov 13, 2019
9fba4d2
Support different types of MiddleManagers by Autoscaler #8695
Nov 18, 2019
5b2e0c6
Support different types of MiddleManagers by Autoscaler #8695
Nov 19, 2019
66fbec5
Support different types of MiddleManagers by Autoscaler #8695
Nov 19, 2019
8d94ff2
Support different types of MiddleManagers by Autoscaler #8695
Nov 22, 2019
e12c2a6
Support different types of MiddleManagers by Autoscaler #8695
Nov 26, 2019
8bd1959
Support different types of MiddleManagers by Autoscaler #8695
Nov 27, 2019
d530f03
Support different types of MiddleManagers by Autoscaler #8695
Dec 2, 2019
16deb7b
Support different types of MiddleManagers by Autoscaler #8695
Dec 3, 2019
c5f1f93
Support different types of MiddleManagers by Autoscaler #8695
Dec 3, 2019
3028f32
Support different types of MiddleManagers by Autoscaler #8695
Dec 5, 2019
7c0a379
Support different types of MiddleManagers by Autoscaler #8695
Jan 29, 2020
10f51a7
Support different types of MiddleManagers by Autoscaler #8695
Jan 30, 2020
931ebba
Support different types of MiddleManagers by Autoscaler #8695
Jan 31, 2020
03f5e62
Support different types of MiddleManagers by Autoscaler #8695
Feb 4, 2020
e16e40b
Support different types of MiddleManagers by Autoscaler #8695
Feb 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
*/
Expand All @@ -55,6 +56,7 @@ public class EC2AutoScaler implements AutoScaler<EC2EnvironmentConfig>

private final int minNumWorkers;
private final int maxNumWorkers;
private final String category;
private final EC2EnvironmentConfig envConfig;
private final AmazonEC2 amazonEC2Client;
private final SimpleWorkerProvisioningConfig config;
Expand All @@ -65,11 +67,13 @@ public EC2AutoScaler(
@JsonProperty("maxNumWorkers") int maxNumWorkers,
@JsonProperty("envConfig") EC2EnvironmentConfig envConfig,
@JacksonInject AmazonEC2 amazonEC2Client,
@JacksonInject SimpleWorkerProvisioningConfig config
@JacksonInject SimpleWorkerProvisioningConfig config,
@JsonProperty("category") String category
)
{
this.minNumWorkers = minNumWorkers;
this.maxNumWorkers = maxNumWorkers;
this.category = category;
this.envConfig = envConfig;
this.amazonEC2Client = amazonEC2Client;
this.config = config;
Expand All @@ -89,6 +93,13 @@ public int getMaxNumWorkers()
return maxNumWorkers;
}

@Override
@JsonProperty
public String getCategory()
{
return category;
}

@Override
@JsonProperty
public EC2EnvironmentConfig getEnvConfig()
Expand Down Expand Up @@ -331,6 +342,7 @@ public String toString()
"envConfig=" + envConfig +
", maxNumWorkers=" + maxNumWorkers +
", minNumWorkers=" + minNumWorkers +
", category=" + category +
'}';
}

Expand All @@ -343,28 +355,16 @@ public boolean equals(Object o)
if (o == null || getClass() != o.getClass()) {
return false;
}

EC2AutoScaler that = (EC2AutoScaler) o;

if (maxNumWorkers != that.maxNumWorkers) {
return false;
}
if (minNumWorkers != that.minNumWorkers) {
return false;
}
if (envConfig != null ? !envConfig.equals(that.envConfig) : that.envConfig != null) {
return false;
}

return true;
return minNumWorkers == that.minNumWorkers &&
maxNumWorkers == that.maxNumWorkers &&
Objects.equals(category, that.category) &&
Objects.equals(envConfig, that.envConfig);
}

@Override
public int hashCode()
{
int result = minNumWorkers;
result = 31 * result + maxNumWorkers;
result = 31 * result + (envConfig != null ? envConfig.hashCode() : 0);
return result;
return Objects.hash(minNumWorkers, maxNumWorkers, category, envConfig);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.google.common.collect.Range;
import org.apache.druid.indexing.overlord.autoscaling.AutoScalingData;
import org.apache.druid.indexing.overlord.autoscaling.SimpleWorkerProvisioningConfig;
import org.apache.druid.indexing.overlord.setup.CategoriedWorkerBehaviorConfig;
import org.apache.druid.jackson.DefaultObjectMapper;
import org.easymock.EasyMock;
import org.junit.After;
Expand Down Expand Up @@ -101,7 +102,8 @@ public void testScale()
1,
ENV_CONFIG,
amazonEC2Client,
managementConfig
managementConfig,
CategoriedWorkerBehaviorConfig.DEFAULT_AUTOSCALER_CATEGORY
);

EasyMock.expect(amazonEC2Client.runInstances(EasyMock.anyObject(RunInstancesRequest.class))).andReturn(
Expand Down Expand Up @@ -145,7 +147,8 @@ public void testIptoIdLookup()
1,
ENV_CONFIG,
amazonEC2Client,
managementConfig
managementConfig,
CategoriedWorkerBehaviorConfig.DEFAULT_AUTOSCALER_CATEGORY
);

final int n = 150;
Expand Down Expand Up @@ -198,7 +201,8 @@ public void testIdToIpLookup()
1,
ENV_CONFIG,
amazonEC2Client,
managementConfig
managementConfig,
CategoriedWorkerBehaviorConfig.DEFAULT_AUTOSCALER_CATEGORY
);

final int n = 150;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public void testSerde() throws Exception
)
),
null,
null
null,
CategoriedWorkerBehaviorConfig.DEFAULT_AUTOSCALER_CATEGORY
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import org.apache.druid.guice.annotations.ExtensionPoint;
import org.apache.druid.indexing.overlord.setup.CategoriedWorkerBehaviorConfig;

import javax.annotation.Nullable;
import java.util.List;
Expand All @@ -36,6 +37,11 @@ public interface AutoScaler<T>

int getMaxNumWorkers();

default String getCategory()
{
return CategoriedWorkerBehaviorConfig.DEFAULT_AUTOSCALER_CATEGORY;
}

/**
* This method is unused, but AutoScaler is an {@link ExtensionPoint}, so we cannot remove it.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.druid.indexing.overlord.autoscaling;

import org.joda.time.Period;

public class CategoriedProvisioningConfig extends PendingTaskBasedWorkerProvisioningConfig
{
@Override
public CategoriedProvisioningConfig setMaxScalingStep(int maxScalingStep)
{
super.setMaxScalingStep(maxScalingStep);
return this;
}

@Override
public CategoriedProvisioningConfig setWorkerIdleTimeout(Period workerIdleTimeout)
{
super.setWorkerIdleTimeout(workerIdleTimeout);
return this;
}

@Override
public CategoriedProvisioningConfig setMaxScalingDuration(Period maxScalingDuration)
{
super.setMaxScalingDuration(maxScalingDuration);
return this;
}

@Override
public CategoriedProvisioningConfig setNumEventsToTrack(int numEventsToTrack)
{
super.setNumEventsToTrack(numEventsToTrack);
return this;
}

@Override
public CategoriedProvisioningConfig setWorkerVersion(String workerVersion)
{
super.setWorkerVersion(workerVersion);
return this;
}

@Override
public CategoriedProvisioningConfig setPendingTaskTimeout(Period pendingTaskTimeout)
{
super.setPendingTaskTimeout(pendingTaskTimeout);
return this;
}

@Override
public CategoriedProvisioningConfig setWorkerPort(int workerPort)
{
super.setWorkerPort(workerPort);
return this;
}
}
Loading