/* * SPDX-License-Identifier: Apache-2.0 * * The OpenSearch Contributors require contributions made to * this file be licensed under the Apache-2.0 license or a * compatible open source license. * * Modifications Copyright OpenSearch Contributors. See * GitHub history for details. */ package org.opensearch.ad.model; import org.opensearch.action.ActionListener; import org.opensearch.transport.TransportService; /** * AD task action enum. Have 2 classes of task actions: * */ public enum ADTaskAction { // ====================================== // Actions execute on coordinating node // ====================================== /** * Start historical analysis for detector. *

Execute on coordinating node

*/ START, /** * Historical analysis finished, so we need to remove detector cache. Used for these cases * */ CLEAN_CACHE, /** * Cancel historical analysis. Currently only used for HC detector. Single entity detector just need * to cancel itself. HC detector need to cancel detector level task on coordinating node. *

Execute on coordinating node

*/ CANCEL, /** * Run next entity for HC detector historical analysis. If no entity, will set detector task as done. *

Execute on coordinating node

*/ NEXT_ENTITY, /** * If any retryable exception happens for HC entity task like limit exceed exception, will push back * entity to pending entities queue and run next entity. *

Execute on coordinating node

*/ PUSH_BACK_ENTITY, /** * Clean stale entities in running entity queue, for example the work node crashed and fail to remove * entity from running entity queue on coordinating node. *

Execute on coordinating node

*/ CLEAN_STALE_RUNNING_ENTITIES, /** * Scale entity task slots for HC historical analysis. * Check {@link org.opensearch.ad.task.ADTaskManager#runNextEntityForHCADHistorical(ADTask, TransportService, ActionListener)}. *

Execute on coordinating node

*/ SCALE_ENTITY_TASK_SLOTS, // ====================================== // Actions execute on lead node // ====================================== /** * Apply for task slots when historical analysis starts. *

Execute on lead node

*/ APPLY_FOR_TASK_SLOTS, /** * Check current available task slots in cluster. HC historical analysis need this to scale task slots. *

Execute on lead node

*/ CHECK_AVAILABLE_TASK_SLOTS, }