Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] modularize x-pack plugins ml and autoscaling #95057

Merged
merged 10 commits into from
Apr 6, 2023
24 changes: 24 additions & 0 deletions x-pack/plugin/autoscaling/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

module org.elasticsearch.autoscaling {
droberts195 marked this conversation as resolved.
Show resolved Hide resolved
requires org.apache.logging.log4j;
requires org.apache.lucene.core;

requires org.elasticsearch.base;
requires org.elasticsearch.server;
requires org.elasticsearch.xcontent;
requires org.elasticsearch.xcore;

exports org.elasticsearch.xpack.autoscaling.action;
exports org.elasticsearch.xpack.autoscaling.capacity;
exports org.elasticsearch.xpack.autoscaling;

provides org.elasticsearch.reservedstate.ReservedClusterStateHandlerProvider
with
org.elasticsearch.xpack.autoscaling.ReservedAutoscalingStateHandlerProvider;
}
38 changes: 38 additions & 0 deletions x-pack/plugin/ml/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

module org.elasticsearch.ml {
requires org.elasticsearch.painless.spi;
requires org.apache.lucene.analysis.common;
requires org.elasticsearch.geo;
requires org.elasticsearch.logging;
requires org.elasticsearch.autoscaling;
requires org.elasticsearch.cli;
requires org.elasticsearch.xcore;
requires org.elasticsearch.base;
requires org.elasticsearch.grok;
requires org.elasticsearch.server;
requires org.elasticsearch.xcontent;
requires org.apache.httpcomponents.httpcore;
requires org.apache.httpcomponents.httpclient;
requires org.apache.httpcomponents.httpasyncclient;
requires org.apache.httpcomponents.httpcore.nio;
requires org.apache.logging.log4j;
requires org.apache.lucene.core;
requires org.apache.lucene.join;
requires commons.math3;

opens org.elasticsearch.xpack.ml to org.elasticsearch.painless.spi; // whitelist resource access
opens org.elasticsearch.xpack.ml.utils; // for exact.properties access

provides org.elasticsearch.painless.spi.PainlessExtension with org.elasticsearch.xpack.ml.MachineLearningPainlessExtension;
provides org.elasticsearch.xpack.autoscaling.AutoscalingExtension with org.elasticsearch.xpack.ml.autoscaling.MlAutoscalingExtension;

exports org.elasticsearch.xpack.ml;
exports org.elasticsearch.xpack.ml.action;
exports org.elasticsearch.xpack.ml.autoscaling;
droberts195 marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
public class MlAutoscalingExtension implements AutoscalingExtension {
private final MachineLearning plugin;

public MlAutoscalingExtension() {
throw new IllegalStateException("Provider must be constructed using PluginsService");
}

public MlAutoscalingExtension(MachineLearning plugin) {
this.plugin = plugin;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ public final class DomainSplitFunction {

static {
try (
var stream = DomainSplitFunction.class.getClassLoader()
.getResourceAsStream("org/elasticsearch/xpack/ml/transforms/exact.properties")
var stream = DomainSplitFunction.class.getClassLoader().getResourceAsStream("org/elasticsearch/xpack/ml/utils/exact.properties")
) {
exact = Streams.readAllLines(stream)
.stream()
Expand Down