Search in sources :

Example 6 with RetryUtil

use of com.netflix.conductor.common.utils.RetryUtil in project conductor by Netflix.

the class CassandraExecutionDAO method updateTaskDefLimit.

@VisibleForTesting
void updateTaskDefLimit(Task task, boolean forceRemove) {
    try {
        if (task.getStatus().isTerminal() || forceRemove) {
            recordCassandraDaoRequests("removeTaskDefLimit", task.getTaskType(), task.getWorkflowType());
            session.execute(deleteTaskDefLimitStatement.bind(task.getTaskDefName(), UUID.fromString(task.getTaskId())));
            new RetryUtil<>().retryOnException(() -> session.execute(deleteTaskDefLimitStatement.bind(task.getTaskDefName(), UUID.fromString(task.getTaskId()))), null, null, 3, "Deleting taskDefLimit", "removeTaskDefLimit");
        } else if (task.getStatus().equals(IN_PROGRESS)) {
            recordCassandraDaoRequests("addTaskDefLimit", task.getTaskType(), task.getWorkflowType());
            new RetryUtil<>().retryOnException(() -> session.execute(updateTaskDefLimitStatement.bind(UUID.fromString(task.getWorkflowInstanceId()), task.getTaskDefName(), UUID.fromString(task.getTaskId()))), null, null, 3, "Adding taskDefLimit", "addTaskDefLimit");
        }
    } catch (Exception e) {
        Monitors.error(CLASS_NAME, "updateTaskDefLimit");
        String errorMsg = String.format("Error updating taskDefLimit for task - %s:%s in workflow: %s", task.getTaskDefName(), task.getTaskId(), task.getWorkflowInstanceId());
        LOGGER.error(errorMsg, e);
        throw new ApplicationException(Code.BACKEND_ERROR, errorMsg, e);
    }
}
Also used : ApplicationException(com.netflix.conductor.core.execution.ApplicationException) RetryUtil(com.netflix.conductor.common.utils.RetryUtil) ApplicationException(com.netflix.conductor.core.execution.ApplicationException) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

RetryUtil (com.netflix.conductor.common.utils.RetryUtil)6 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)6 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 MapType (com.fasterxml.jackson.databind.type.MapType)5 TypeFactory (com.fasterxml.jackson.databind.type.TypeFactory)5 Trace (com.netflix.conductor.annotations.Trace)5 EventExecution (com.netflix.conductor.common.metadata.events.EventExecution)5 Task (com.netflix.conductor.common.metadata.tasks.Task)5 TaskExecLog (com.netflix.conductor.common.metadata.tasks.TaskExecLog)5 SearchResult (com.netflix.conductor.common.run.SearchResult)5 TaskSummary (com.netflix.conductor.common.run.TaskSummary)5 Workflow (com.netflix.conductor.common.run.Workflow)5 WorkflowSummary (com.netflix.conductor.common.run.WorkflowSummary)5 Message (com.netflix.conductor.core.events.queue.Message)5 IndexDAO (com.netflix.conductor.dao.IndexDAO)5 ElasticSearchConfiguration (com.netflix.conductor.elasticsearch.ElasticSearchConfiguration)5 Monitors (com.netflix.conductor.metrics.Monitors)5 IOException (java.io.IOException)5 SimpleDateFormat (java.text.SimpleDateFormat)5 Instant (java.time.Instant)5