sascha-coenen commented on a change in pull request #9350: Overlord to support
autoscalers per indexer/middlemanager category
URL: https://github.com/apache/druid/pull/9350#discussion_r387813003
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/overlord/setup/DefaultWorkerBehaviorConfig.java
##########
@@ -23,29 +23,42 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.druid.indexing.overlord.autoscaling.AutoScaler;
import org.apache.druid.indexing.overlord.autoscaling.NoopAutoScaler;
+import org.apache.druid.indexing.worker.config.WorkerConfig;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
/**
+ * This configuration allows overlord to work with several autoscalers to run
tasks of different categories.
*/
public class DefaultWorkerBehaviorConfig implements WorkerBehaviorConfig
{
- private static final AutoScaler DEFAULT_AUTOSCALER = new NoopAutoScaler();
+ // Use the same category constant as for worker category to match default
workers and autoscalers
+ public static final String DEFAULT_AUTOSCALER_CATEGORY =
WorkerConfig.DEFAULT_CATEGORY;
+ private static final AutoScaler DEFAULT_AUTOSCALER = new
NoopAutoScaler(DEFAULT_AUTOSCALER_CATEGORY);
public static DefaultWorkerBehaviorConfig defaultConfig()
{
- return new DefaultWorkerBehaviorConfig(DEFAULT_STRATEGY,
DEFAULT_AUTOSCALER);
+ return new DefaultWorkerBehaviorConfig(DEFAULT_STRATEGY,
DEFAULT_AUTOSCALER, null);
}
private final WorkerSelectStrategy selectStrategy;
- private final AutoScaler autoScaler;
+ private final List<AutoScaler> autoScalers;
@JsonCreator
public DefaultWorkerBehaviorConfig(
@JsonProperty("selectStrategy") WorkerSelectStrategy selectStrategy,
- @JsonProperty("autoScaler") AutoScaler autoScaler
+ @JsonProperty("autoScaler") AutoScaler autoScaler,
+ @JsonProperty("autoScalers") List<AutoScaler> autoScalers
)
{
this.selectStrategy = selectStrategy;
- this.autoScaler = autoScaler;
+ this.autoScalers = (autoScaler != null) ?
Collections.singletonList(autoScaler) : autoScalers;
+ if (this.autoScalers == null) {
+ throw new IllegalArgumentException("Either autoScaler or autoScalers
property needs to be provided");
Review comment:
done
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]