private List<TaskModel> startWorkflow(WorkflowModel workflow)
            throws TerminateWorkflowException {
        final WorkflowDef workflowDef = workflow.getWorkflowDefinition();

        LOGGER.debug("Starting workflow: {}", workflow);

        // The tasks will be empty in case of new workflow
        List<TaskModel> tasks = workflow.getTasks();
        // Check if the workflow is a re-run case or if it is a new workflow execution
        if (workflow.getReRunFromWorkflowId() == null || tasks.isEmpty()) {

            if (workflowDef.getTasks().isEmpty()) {
                throw new TerminateWorkflowException(
                        "No tasks found to be executed", WorkflowModel.Status.COMPLETED);
            }

            WorkflowTask taskToSchedule =
                    workflowDef
                            .getTasks()
                            .get(0); // Nothing is running yet - so schedule the first task
            // Loop until a non-skipped task is found
            while (isTaskSkipped(taskToSchedule, workflow)) {
                taskToSchedule = workflowDef.getNextTask(taskToSchedule.getTaskReferenceName());
            }

            // In case of a new workflow, the first non-skippable task will be scheduled
            return getTasksToBeScheduled(workflow, taskToSchedule, 0);
        }

        // Get the first task to schedule
        TaskModel rerunFromTask =
                tasks.stream()
                        .findFirst()
                        .map(
                                task -> {
                                    task.setStatus(SCHEDULED);
                                    task.setRetried(true);
                                    task.setRetryCount(0);
                                    return task;
                                })
                        .orElseThrow(
                                () -> {
                                    String reason =
                                            String.format(
                                                    "The workflow %s is marked for re-run from %s but could not find the starting task",
                                                    workflow.getWorkflowId(),
                                                    workflow.getReRunFromWorkflowId());
                                    return new TerminateWorkflowException(reason);
                                });

        return Collections.singletonList(rerunFromTask);
    }
Decider evaluates the state of the workflow by inspecting the current state along with the
blueprint. The result of the evaluation is either to schedule further tasks, complete/fail the
workflow or do nothing.
core/src/main/java/com/netflix/conductor/core/execution/DeciderService.java