Skip to content

Commit

Permalink
Revert "[8.15] [ML] Downloaded and write model parts using multiple s…
Browse files Browse the repository at this point in the history
…treams (#112869)" (#113017)

This reverts commit f48a1c6.
  • Loading branch information
davidkyle authored Sep 17, 2024
1 parent 868699c commit 6086aac
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 902 deletions.
5 changes: 0 additions & 5 deletions docs/changelog/111684.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions docs/changelog/112869.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,9 @@
import java.util.Locale;

public enum Level {
INFO {
public org.apache.logging.log4j.Level log4jLevel() {
return org.apache.logging.log4j.Level.INFO;
}
},
WARNING {
public org.apache.logging.log4j.Level log4jLevel() {
return org.apache.logging.log4j.Level.WARN;
}
},
ERROR {
public org.apache.logging.log4j.Level log4jLevel() {
return org.apache.logging.log4j.Level.ERROR;
}
};

public abstract org.apache.logging.log4j.Level log4jLevel();
INFO,
WARNING,
ERROR;

/**
* Case-insensitive from string method.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.threadpool.ExecutorBuilder;
import org.elasticsearch.threadpool.FixedExecutorBuilder;
import org.elasticsearch.xpack.core.ml.packageloader.action.GetTrainedModelPackageConfigAction;
import org.elasticsearch.xpack.core.ml.packageloader.action.LoadTrainedModelPackageAction;
import org.elasticsearch.xpack.ml.packageloader.action.ModelDownloadTask;
import org.elasticsearch.xpack.ml.packageloader.action.ModelImporter;
import org.elasticsearch.xpack.ml.packageloader.action.TransportGetTrainedModelPackageConfigAction;
import org.elasticsearch.xpack.ml.packageloader.action.TransportLoadTrainedModelPackage;

Expand All @@ -49,15 +44,16 @@ public class MachineLearningPackageLoader extends Plugin implements ActionPlugin
Setting.Property.Dynamic
);

// re-using thread pool setup by the ml plugin
public static final String UTILITY_THREAD_POOL_NAME = "ml_utility";

// This link will be invalid for serverless, but serverless will never be
// air-gapped, so this message should never be needed.
private static final String MODEL_REPOSITORY_DOCUMENTATION_LINK = format(
"https://www.elastic.co/guide/en/machine-learning/%s/ml-nlp-elser.html#air-gapped-install",
Build.current().version().replaceFirst("^(\\d+\\.\\d+).*", "$1")
);

public static final String MODEL_DOWNLOAD_THREADPOOL_NAME = "model_download";

public MachineLearningPackageLoader() {}

@Override
Expand Down Expand Up @@ -85,24 +81,6 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
);
}

@Override
public List<ExecutorBuilder<?>> getExecutorBuilders(Settings settings) {
return List.of(modelDownloadExecutor(settings));
}

public static FixedExecutorBuilder modelDownloadExecutor(Settings settings) {
// Threadpool with a fixed number of threads for
// downloading the model definition files
return new FixedExecutorBuilder(
settings,
MODEL_DOWNLOAD_THREADPOOL_NAME,
ModelImporter.NUMBER_OF_STREAMS,
-1, // unbounded queue size
"xpack.ml.model_download_thread_pool",
EsExecutors.TaskTrackingConfig.DO_NOT_TRACK
);
}

@Override
public List<BootstrapCheck> getBootstrapChecks() {
return List.of(new BootstrapCheck() {
Expand Down
Loading

0 comments on commit 6086aac

Please sign in to comment.