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

Commit

Permalink
Merge pull request #945 from Netflix/update_workflow_then_task_for_retry
Browse files Browse the repository at this point in the history
update workflow before creating/updating task for retry/rerun
  • Loading branch information
apanicker-nflx authored Jan 16, 2019
2 parents 5b52527 + 825f15f commit a9a15de
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,10 @@ public void retry(String workflowId) {
}
});

scheduleTask(workflow, rescheduledTasks);

workflow.setStatus(WorkflowStatus.RUNNING);
executionDAOFacade.updateWorkflow(workflow);

scheduleTask(workflow, rescheduledTasks);
executionDAOFacade.updateTasks(workflow.getTasks());

decide(workflowId);
Expand Down Expand Up @@ -1236,6 +1236,16 @@ private boolean rerunWF(String workflowId, String taskId, Map<String, Object> ta
}

if (rerunFromTask != null) {
// set workflow as RUNNING
workflow.setStatus(WorkflowStatus.RUNNING);
if (correlationId != null) {
workflow.setCorrelationId(correlationId);
}
if (workflowInput != null) {
workflow.setInput(workflowInput);
}
executionDAOFacade.updateWorkflow(workflow);

// Remove all tasks after the "rerunFromTask"
for (Task task : workflow.getTasks()) {
if (task.getSeq() > rerunFromTask.getSeq()) {
Expand All @@ -1256,15 +1266,6 @@ private boolean rerunWF(String workflowId, String taskId, Map<String, Object> ta
rerunFromTask.setExecuted(false);
executionDAOFacade.updateTask(rerunFromTask);

// and set workflow as RUNNING
workflow.setStatus(WorkflowStatus.RUNNING);
if (correlationId != null) {
workflow.setCorrelationId(correlationId);
}
if (workflowInput != null) {
workflow.setInput(workflowInput);
}
executionDAOFacade.updateWorkflow(workflow);
decide(workflowId);
return true;
}
Expand Down

0 comments on commit a9a15de

Please sign in to comment.