public static boolean isBuiltIn(String taskType) { return is(taskType) && builtInTasks.contains(taskType); }
@VisibleForTesting List<Task> getNextTask(Workflow workflow, Task task) { final WorkflowDef workflowDef = workflow.getWorkflowDefinition(); // Get the following task after the last completed task if (SystemTaskType.is(task.getTaskType()) && SystemTaskType.DECISION.name().equals(task.getTaskType())) { if (task.getInputData().get("hasChildren") != null) { return Collections.emptyList(); } } String taskReferenceName = task.getReferenceTaskName(); WorkflowTask taskToSchedule = workflowDef.getNextTask(taskReferenceName); while (isTaskSkipped(taskToSchedule, workflow)) { taskToSchedule = workflowDef.getNextTask(taskToSchedule.getTaskReferenceName()); } if (taskToSchedule != null) { return getTasksToBeScheduled(workflow, taskToSchedule, 0); } return Collections.emptyList(); }
if (SystemTaskType.is(pendingTask.getTaskType()) && !pendingTask.getStatus().isTerminal()) {
public int requeuePendingTasks(String taskType) { int count = 0; List<Task> tasks = getPendingTasksForTaskType(taskType); for (Task pending : tasks) { if (SystemTaskType.is(pending.getTaskType())) { continue; } if (pending.getStatus().isTerminal()) { continue; } logger.info("Requeuing Task: workflowId=" + pending.getWorkflowInstanceId() + ", taskType=" + pending.getTaskType() + ", taskId=" + pending.getTaskId()); boolean pushed = requeue(pending); if (pushed) { count++; } } return count; }
private int requeuePendingTasks(Workflow workflow, long threshold) { int count = 0; List<Task> tasks = workflow.getTasks(); for (Task pending : tasks) { if (SystemTaskType.is(pending.getTaskType())) { continue; } if (pending.getStatus().isTerminal()) { continue; } if (pending.getUpdateTime() < threshold) { logger.info("Requeuing Task: workflowId=" + workflow.getWorkflowId() + ", taskType=" + pending.getTaskType() + ", taskId=" + pending.getTaskId()); long callback = pending.getCallbackAfterSeconds(); if (callback < 0) { callback = 0; } boolean pushed = queueDAO.pushIfNotExists(QueueUtils.getQueueName(pending), pending.getTaskId(), callback); if (pushed) { count++; } } } return count; }
private final Predicate<Task> isSystemTask = task -> SystemTaskType.is(task.getTaskType());
public static boolean isBuiltIn(String taskType) { return is(taskType) && builtInTasks.contains(taskType); }
@VisibleForTesting List<Task> getNextTask(Workflow workflow, Task task) { final WorkflowDef workflowDef = workflow.getWorkflowDefinition(); // Get the following task after the last completed task if (SystemTaskType.is(task.getTaskType()) && SystemTaskType.DECISION.name().equals(task.getTaskType())) { if (task.getInputData().get("hasChildren") != null) { return Collections.emptyList(); } } String taskReferenceName = task.getReferenceTaskName(); WorkflowTask taskToSchedule = workflowDef.getNextTask(taskReferenceName); while (isTaskSkipped(taskToSchedule, workflow)) { taskToSchedule = workflowDef.getNextTask(taskToSchedule.getTaskReferenceName()); } if (taskToSchedule != null) { return getTasksToBeScheduled(workflow, taskToSchedule, 0); } return Collections.emptyList(); }
if (SystemTaskType.is(pendingTask.getTaskType()) && !pendingTask.getStatus().isTerminal()) {
public int requeuePendingTasks(String taskType) { int count = 0; List<Task> tasks = getPendingTasksForTaskType(taskType); for (Task pending : tasks) { if (SystemTaskType.is(pending.getTaskType())) { continue; } if (pending.getStatus().isTerminal()) { continue; } logger.info("Requeuing Task: workflowId=" + pending.getWorkflowInstanceId() + ", taskType=" + pending.getTaskType() + ", taskId=" + pending.getTaskId()); boolean pushed = requeue(pending); if (pushed) { count++; } } return count; }
private int requeuePendingTasks(Workflow workflow, long threshold) { int count = 0; List<Task> tasks = workflow.getTasks(); for (Task pending : tasks) { if (SystemTaskType.is(pending.getTaskType())) { continue; } if (pending.getStatus().isTerminal()) { continue; } if (pending.getUpdateTime() < threshold) { logger.info("Requeuing Task: workflowId=" + workflow.getWorkflowId() + ", taskType=" + pending.getTaskType() + ", taskId=" + pending.getTaskId()); long callback = pending.getCallbackAfterSeconds(); if (callback < 0) { callback = 0; } boolean pushed = queueDAO.pushIfNotExists(QueueUtils.getQueueName(pending), pending.getTaskId(), callback); if (pushed) { count++; } } } return count; }
private final Predicate<Task> isSystemTask = task -> SystemTaskType.is(task.getTaskType());