15
15
import org .elasticsearch .common .Strings ;
16
16
import org .elasticsearch .common .io .stream .NamedWriteableRegistry ;
17
17
import org .elasticsearch .common .settings .Setting ;
18
- import org .elasticsearch .common .settings .Settings ;
19
- import org .elasticsearch .common .util .concurrent .EsExecutors ;
20
18
import org .elasticsearch .plugins .ActionPlugin ;
21
19
import org .elasticsearch .plugins .Plugin ;
22
20
import org .elasticsearch .tasks .Task ;
23
- import org .elasticsearch .threadpool .ExecutorBuilder ;
24
- import org .elasticsearch .threadpool .FixedExecutorBuilder ;
25
21
import org .elasticsearch .xpack .core .ml .packageloader .action .GetTrainedModelPackageConfigAction ;
26
22
import org .elasticsearch .xpack .core .ml .packageloader .action .LoadTrainedModelPackageAction ;
27
23
import org .elasticsearch .xpack .ml .packageloader .action .ModelDownloadTask ;
28
- import org .elasticsearch .xpack .ml .packageloader .action .ModelImporter ;
29
24
import org .elasticsearch .xpack .ml .packageloader .action .TransportGetTrainedModelPackageConfigAction ;
30
25
import org .elasticsearch .xpack .ml .packageloader .action .TransportLoadTrainedModelPackage ;
31
26
@@ -49,15 +44,16 @@ public class MachineLearningPackageLoader extends Plugin implements ActionPlugin
49
44
Setting .Property .Dynamic
50
45
);
51
46
47
+ // re-using thread pool setup by the ml plugin
48
+ public static final String UTILITY_THREAD_POOL_NAME = "ml_utility" ;
49
+
52
50
// This link will be invalid for serverless, but serverless will never be
53
51
// air-gapped, so this message should never be needed.
54
52
private static final String MODEL_REPOSITORY_DOCUMENTATION_LINK = format (
55
53
"https://www.elastic.co/guide/en/machine-learning/%s/ml-nlp-elser.html#air-gapped-install" ,
56
54
Build .current ().version ().replaceFirst ("^(\\ d+\\ .\\ d+).*" , "$1" )
57
55
);
58
56
59
- public static final String MODEL_DOWNLOAD_THREADPOOL_NAME = "model_download" ;
60
-
61
57
public MachineLearningPackageLoader () {}
62
58
63
59
@ Override
@@ -85,24 +81,6 @@ public List<NamedWriteableRegistry.Entry> getNamedWriteables() {
85
81
);
86
82
}
87
83
88
- @ Override
89
- public List <ExecutorBuilder <?>> getExecutorBuilders (Settings settings ) {
90
- return List .of (modelDownloadExecutor (settings ));
91
- }
92
-
93
- public static FixedExecutorBuilder modelDownloadExecutor (Settings settings ) {
94
- // Threadpool with a fixed number of threads for
95
- // downloading the model definition files
96
- return new FixedExecutorBuilder (
97
- settings ,
98
- MODEL_DOWNLOAD_THREADPOOL_NAME ,
99
- ModelImporter .NUMBER_OF_STREAMS ,
100
- -1 , // unbounded queue size
101
- "xpack.ml.model_download_thread_pool" ,
102
- EsExecutors .TaskTrackingConfig .DO_NOT_TRACK
103
- );
104
- }
105
-
106
84
@ Override
107
85
public List <BootstrapCheck > getBootstrapChecks () {
108
86
return List .of (new BootstrapCheck () {
0 commit comments