Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Optional task execution log indexing (#1465)
Browse files Browse the repository at this point in the history
* Make tasklog indexing optional

* Create task log index only if it is enabled

* Optional task execution logs
  • Loading branch information
mdepak authored and apanicker-nflx committed Jan 7, 2020
1 parent b163b9a commit 4a33c87
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public interface Configuration {
String IGNORE_LOCKING_EXCEPTIONS_PROPERTY_NAME = "workflow.decider.locking.exceptions.ignore";
boolean IGNORE_LOCKING_EXCEPTIONS_DEFAULT_VALUE = false;

String TASKEXECLOG_INDEXING_ENABLED_PROPERTY_NAME = "workflow.taskExecLog.indexing.enabled";
boolean TASKEXECLOG_INDEXING_ENABLED_DEFAULT_VALUE = true;

//TODO add constants for input/output external payload related properties.

default DB getDB() {
Expand Down Expand Up @@ -102,6 +105,13 @@ default boolean enableWorkflowExecutionLock() {
return getBooleanProperty(EXECUTION_LOCK_ENABLED_PROPERTY_NAME, EXECUTION_LOCK_ENABLED_DEFAULT_VALUE);
}

/**
* @return if true(default), enables task execution log indexing
*/
default boolean isTaskExecLogIndexingEnabled() {
return getBooleanProperty(TASKEXECLOG_INDEXING_ENABLED_PROPERTY_NAME, TASKEXECLOG_INDEXING_ENABLED_DEFAULT_VALUE);
}

/**
* @return time frequency in seconds, at which the workflow sweeper should run to evaluate running workflows.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.netflix.conductor.dao.RateLimitingDao;
import com.netflix.conductor.metrics.Monitors;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.ScheduledThreadPoolExecutor;
Expand Down Expand Up @@ -400,10 +401,13 @@ public boolean exceedsRateLimitPerFrequency(Task task, TaskDef taskDef) {
}

public void addTaskExecLog(List<TaskExecLog> logs) {
if (config.enableAsyncIndexing()) {
indexDAO.asyncAddTaskExecutionLogs(logs);
} else {
indexDAO.addTaskExecutionLogs(logs);
if (config.isTaskExecLogIndexingEnabled()) {
if (config.enableAsyncIndexing()) {
indexDAO.asyncAddTaskExecutionLogs(logs);
}
else {
indexDAO.addTaskExecutionLogs(logs);
}
}
}

Expand All @@ -420,7 +424,7 @@ public SearchResult<String> searchTasks(String query, String freeText, int start
}

public List<TaskExecLog> getTaskExecutionLogs(String taskId) {
return indexDAO.getTaskExecutionLogs(taskId);
return config.isTaskExecLogIndexingEnabled() ? indexDAO.getTaskExecutionLogs(taskId) : Collections.emptyList();
}

class DelayWorkflowUpdate implements Runnable {
Expand Down

0 comments on commit 4a33c87

Please sign in to comment.