From 5b018aecd4f0a57d081b89bfa7d31f521ffc341f Mon Sep 17 00:00:00 2001 From: Shailesh Jagannath Padave Date: Tue, 19 Nov 2024 15:04:29 +0530 Subject: [PATCH] Code changes in decider service --- .../netflix/conductor/common/metadata/tasks/TaskDef.java | 2 +- .../netflix/conductor/core/execution/DeciderService.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/conductor-clients/java/conductor-java-sdk/conductor-client/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskDef.java b/conductor-clients/java/conductor-java-sdk/conductor-client/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskDef.java index 19f0adcc0..3eeed4a5b 100644 --- a/conductor-clients/java/conductor-java-sdk/conductor-client/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskDef.java +++ b/conductor-clients/java/conductor-java-sdk/conductor-client/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskDef.java @@ -427,7 +427,7 @@ public long getTotalTimeoutSeconds() { public void setTotalTimeoutSeconds(long totalTimeoutSeconds) { this.totalTimeoutSeconds = totalTimeoutSeconds; } - + public String toString() { return name; } diff --git a/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java b/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java index e1bacb34d..3d06a1022 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java @@ -629,6 +629,7 @@ Optional retry( rescheduled.setStartTime(0); rescheduled.setEndTime(0); rescheduled.setWorkerId(null); + rescheduled.setFirstStartTime(task.getFirstStartTime()); if (StringUtils.isNotBlank(task.getExternalInputPayloadStoragePath())) { rescheduled.setExternalInputPayloadStoragePath( @@ -710,14 +711,22 @@ void checkTaskTimeout(TaskDef taskDef, TaskModel task) { } long timeout = 1000L * taskDef.getTimeoutSeconds(); + long totalTaskTimeout = 1000L * taskDef.getTotalTimeoutSeconds(); long now = System.currentTimeMillis(); long elapsedTime = now - (task.getStartTime() + ((long) task.getStartDelayInSeconds() * 1000L)); + long elapsedTimeFromFirstTaskExecution = + now - (task.getFirstStartTime() + ((long) task.getStartDelayInSeconds() * 1000L)); + if (elapsedTime < timeout) { return; } + if(elapsedTimeFromFirstTaskExecution < totalTaskTimeout) { + return; + } + String reason = String.format( "Task timed out after %d seconds. Timeout configured as %d seconds. "