diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java index 6a75fb0b0fe..212b481ca11 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java @@ -307,8 +307,8 @@ public class MachineLearning implements ActionPlugin { new InvalidLicenseEnforcer(settings, licenseState, threadPool, datafeedManager, autodetectProcessManager); PersistentTasksExecutorRegistry persistentTasksExecutorRegistry = new PersistentTasksExecutorRegistry(Settings.EMPTY, Arrays.asList( - new OpenJobAction.OpenJobPersistentTasksExecutor(settings, licenseState, clusterService, autodetectProcessManager), - new StartDatafeedAction.StartDatafeedPersistentTasksExecutor(settings, licenseState, datafeedManager) + new OpenJobAction.OpenJobPersistentTasksExecutor(settings, clusterService, autodetectProcessManager), + new StartDatafeedAction.StartDatafeedPersistentTasksExecutor(settings, datafeedManager) )); return Arrays.asList( diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java index 7e87c3221a5..1243af7213d 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java @@ -447,15 +447,13 @@ public class OpenJobAction extends Action { private final AutodetectProcessManager autodetectProcessManager; - private final XPackLicenseState licenseState; private final int maxNumberOfOpenJobs; private volatile int maxConcurrentJobAllocations; - public OpenJobPersistentTasksExecutor(Settings settings, XPackLicenseState licenseState, - ClusterService clusterService, AutodetectProcessManager autodetectProcessManager) { + public OpenJobPersistentTasksExecutor(Settings settings, ClusterService clusterService, + AutodetectProcessManager autodetectProcessManager) { super(settings, TASK_NAME, ThreadPool.Names.MANAGEMENT); - this.licenseState = licenseState; this.autodetectProcessManager = autodetectProcessManager; this.maxNumberOfOpenJobs = AutodetectProcessManager.MAX_RUNNING_JOBS_PER_NODE.get(settings); this.maxConcurrentJobAllocations = MachineLearning.CONCURRENT_JOB_ALLOCATIONS.get(settings); @@ -470,21 +468,17 @@ public class OpenJobAction extends Action { private final DatafeedManager datafeedManager; - private final XPackLicenseState licenseState; private final IndexNameExpressionResolver resolver; - public StartDatafeedPersistentTasksExecutor(Settings settings, XPackLicenseState licenseState, DatafeedManager datafeedManager) { + public StartDatafeedPersistentTasksExecutor(Settings settings, DatafeedManager datafeedManager) { super(settings, TASK_NAME, ThreadPool.Names.MANAGEMENT); - this.licenseState = licenseState; this.datafeedManager = datafeedManager; this.resolver = new IndexNameExpressionResolver(settings); } @@ -490,18 +488,14 @@ public class StartDatafeedAction @Override public void validate(DatafeedParams params, ClusterState clusterState) { - if (licenseState.isMachineLearningAllowed()) { - MlMetadata mlMetadata = clusterState.metaData().custom(MlMetadata.TYPE); - PersistentTasksCustomMetaData tasks = clusterState.getMetaData().custom(PersistentTasksCustomMetaData.TYPE); - StartDatafeedAction.validate(params.getDatafeedId(), mlMetadata, tasks); - Assignment assignment = selectNode(logger, params.getDatafeedId(), clusterState, resolver); - if (assignment.getExecutorNode() == null) { - String msg = "No node found to start datafeed [" + params.getDatafeedId() - + "], allocation explanation [" + assignment.getExplanation() + "]"; - throw new ElasticsearchException(msg); - } - } else { - throw LicenseUtils.newComplianceException(XPackPlugin.MACHINE_LEARNING); + MlMetadata mlMetadata = clusterState.metaData().custom(MlMetadata.TYPE); + PersistentTasksCustomMetaData tasks = clusterState.getMetaData().custom(PersistentTasksCustomMetaData.TYPE); + StartDatafeedAction.validate(params.getDatafeedId(), mlMetadata, tasks); + Assignment assignment = selectNode(logger, params.getDatafeedId(), clusterState, resolver); + if (assignment.getExecutorNode() == null) { + String msg = "No node found to start datafeed [" + params.getDatafeedId() + + "], allocation explanation [" + assignment.getExplanation() + "]"; + throw new ElasticsearchException(msg); } }