Search in sources :

Example 6 with SubWorkflow

use of com.netflix.conductor.core.execution.tasks.SubWorkflow in project conductor by Netflix.

the class AbstractWorkflowServiceTest method testSimpleWorkflowWithTaskSpecificDomain.

@Test
public void testSimpleWorkflowWithTaskSpecificDomain() throws Exception {
    long startTimeTimestamp = System.currentTimeMillis();
    clearWorkflows();
    createWorkflowWithSubWorkflow();
    metadataService.getWorkflowDef(LINEAR_WORKFLOW_T1_T2_SW, 1);
    String correlationId = "unit_test_sw";
    Map<String, Object> input = new HashMap<>();
    String inputParam1 = "p1 value";
    input.put("param1", inputParam1);
    input.put("param2", "p2 value");
    Map<String, String> taskToDomain = new HashMap<>();
    taskToDomain.put("junit_task_3", "domain1");
    taskToDomain.put("junit_task_2", "domain1");
    // Poll before so that a polling for this task is "active"
    Task task = workflowExecutionService.poll("junit_task_3", "task1.junit.worker", "domain1");
    assertNull(task);
    task = workflowExecutionService.poll("junit_task_2", "task1.junit.worker", "domain1");
    assertNull(task);
    String workflowId = startOrLoadWorkflowExecution("simpleWorkflowWithTaskSpecificDomain", LINEAR_WORKFLOW_T1_T2_SW, 1, correlationId, input, null, taskToDomain);
    assertNotNull(workflowId);
    Workflow workflow = workflowExecutor.getWorkflow(workflowId, false);
    assertNotNull(workflow);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(workflow.getReasonForIncompletion(), RUNNING, workflow.getStatus());
    assertEquals(RUNNING, workflow.getStatus());
    // The very first task is the one that should be scheduled.
    assertEquals(1, workflow.getTasks().size());
    // Check Size
    Map<String, Integer> sizes = workflowExecutionService.getTaskQueueSizes(Arrays.asList("domain1:junit_task_3", "junit_task_3"));
    assertEquals(sizes.get("domain1:junit_task_3").intValue(), 1);
    assertEquals(sizes.get("junit_task_3").intValue(), 0);
    // Polling for the first task
    task = workflowExecutionService.poll("junit_task_3", "task1.junit.worker");
    assertNull(task);
    task = workflowExecutionService.poll("junit_task_3", "task1.junit.worker", "domain1");
    assertNotNull(task);
    assertEquals("junit_task_3", task.getTaskType());
    assertTrue(workflowExecutionService.ackTaskReceived(task.getTaskId()));
    assertEquals(workflowId, task.getWorkflowInstanceId());
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    List<Task> tasks = workflowExecutionService.getTasks(task.getTaskType(), null, 10);
    assertNotNull(tasks);
    assertEquals(1, tasks.size());
    task = tasks.get(0);
    assertEquals(workflowId, task.getWorkflowInstanceId());
    String task1Op = "task1.Done";
    task.getOutputData().put("op", task1Op);
    task.setStatus(COMPLETED);
    workflowExecutionService.updateTask(task);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(RUNNING, workflow.getStatus());
    // Simulating SystemTaskWorkerCoordinator to execute async system tasks
    String subWorkflowTaskId = workflow.getTaskByRefName("sw1").getTaskId();
    workflowExecutor.executeSystemTask(dummySubWorkflowSystemTask, subWorkflowTaskId, 1);
    task = workflowExecutionService.poll("junit_task_1", "task1.junit.worker");
    assertNotNull(task);
    assertEquals("junit_task_1", task.getTaskType());
    workflow = workflowExecutionService.getExecutionStatus(workflowId, false);
    assertTrue(workflowExecutionService.ackTaskReceived(task.getTaskId()));
    assertNotNull(workflow.getTaskToDomain());
    assertEquals(workflow.getTaskToDomain().size(), 2);
    task.setStatus(COMPLETED);
    task.setReasonForIncompletion("unit test failure");
    workflowExecutionService.updateTask(task);
    task = workflowExecutionService.poll("junit_task_2", "task2.junit.worker", "domain1");
    assertNotNull(task);
    assertEquals("junit_task_2", task.getTaskType());
    assertTrue(workflowExecutionService.ackTaskReceived(task.getTaskId()));
    task.setStatus(COMPLETED);
    task.setReasonForIncompletion("unit test failure");
    workflowExecutionService.updateTask(task);
    // Execute again to re-evaluate the Subworkflow task.
    workflowExecutor.executeSystemTask(dummySubWorkflowSystemTask, subWorkflowTaskId, 1);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(WorkflowStatus.COMPLETED, workflow.getStatus());
    tasks = workflow.getTasks();
    assertNotNull(tasks);
    assertEquals(2, tasks.size());
    assertTrue("Found " + workflow.getOutput().toString(), workflow.getOutput().containsKey("o3"));
    assertEquals("task1.Done", workflow.getOutput().get("o3"));
    Predicate<PollData> pollDataWithinTestTimes = pollData -> pollData.getLastPollTime() != 0 && pollData.getLastPollTime() > startTimeTimestamp;
    List<PollData> pollData = workflowExecutionService.getPollData("junit_task_3").stream().filter(pollDataWithinTestTimes).collect(Collectors.toList());
    assertEquals(2, pollData.size());
    for (PollData pd : pollData) {
        assertEquals(pd.getQueueName(), "junit_task_3");
        assertEquals(pd.getWorkerId(), "task1.junit.worker");
        assertTrue(pd.getLastPollTime() != 0);
        if (pd.getDomain() != null) {
            assertEquals(pd.getDomain(), "domain1");
        }
    }
    List<PollData> pdList = workflowExecutionService.getAllPollData().stream().filter(pollDataWithinTestTimes).collect(Collectors.toList());
    int count = 0;
    for (PollData pd : pdList) {
        if (pd.getQueueName().equals("junit_task_3")) {
            count++;
        }
    }
    assertEquals(2, count);
}
Also used : TaskUtils(com.netflix.conductor.common.utils.TaskUtils) MethodSorters(org.junit.runners.MethodSorters) SubWorkflow(com.netflix.conductor.core.execution.tasks.SubWorkflow) Arrays(java.util.Arrays) TimeoutPolicy(com.netflix.conductor.common.metadata.tasks.TaskDef.TimeoutPolicy) TEMP_FILE_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.TEMP_FILE_PATH) LoggerFactory(org.slf4j.LoggerFactory) Task(com.netflix.conductor.common.metadata.tasks.Task) StringUtils(org.apache.commons.lang3.StringUtils) Future(java.util.concurrent.Future) COMPLETED_WITH_ERRORS(com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED_WITH_ERRORS) RerunWorkflowRequest(com.netflix.conductor.common.metadata.workflow.RerunWorkflowRequest) Workflow(com.netflix.conductor.common.run.Workflow) IN_PROGRESS(com.netflix.conductor.common.metadata.tasks.Task.Status.IN_PROGRESS) Map(java.util.Map) After(org.junit.After) PollData(com.netflix.conductor.common.metadata.tasks.PollData) WorkflowExecutor(com.netflix.conductor.core.execution.WorkflowExecutor) TASK_OUTPUT_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.TASK_OUTPUT_PATH) Terminate(com.netflix.conductor.core.execution.tasks.Terminate) WorkflowRepairService(com.netflix.conductor.core.execution.WorkflowRepairService) TaskDef(com.netflix.conductor.common.metadata.tasks.TaskDef) WorkflowStatus(com.netflix.conductor.common.run.Workflow.WorkflowStatus) MetadataMapperService(com.netflix.conductor.core.metadata.MetadataMapperService) Predicate(java.util.function.Predicate) Set(java.util.Set) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) Executors(java.util.concurrent.Executors) SCHEDULED(com.netflix.conductor.common.metadata.tasks.Task.Status.SCHEDULED) QueueDAO(com.netflix.conductor.dao.QueueDAO) INPUT_PAYLOAD_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.INPUT_PAYLOAD_PATH) List(java.util.List) DynamicForkJoinTaskList(com.netflix.conductor.common.metadata.workflow.DynamicForkJoinTaskList) Assert.assertFalse(org.junit.Assert.assertFalse) TIMED_OUT(com.netflix.conductor.common.metadata.tasks.Task.Status.TIMED_OUT) COMPLETED(com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED) ExecutionService(com.netflix.conductor.service.ExecutionService) FixMethodOrder(org.junit.FixMethodOrder) JsonMapperProvider(com.netflix.conductor.common.utils.JsonMapperProvider) MetadataService(com.netflix.conductor.service.MetadataService) WorkflowContext(com.netflix.conductor.core.WorkflowContext) BeforeClass(org.junit.BeforeClass) SubWorkflowParams(com.netflix.conductor.common.metadata.workflow.SubWorkflowParams) Status(com.netflix.conductor.common.metadata.tasks.Task.Status) HashMap(java.util.HashMap) TaskResult(com.netflix.conductor.common.metadata.tasks.TaskResult) Inject(javax.inject.Inject) SUB_WORKFLOW(com.netflix.conductor.common.metadata.workflow.TaskType.SUB_WORKFLOW) LinkedList(java.util.LinkedList) ExpectedException(org.junit.rules.ExpectedException) RUNNING(com.netflix.conductor.common.run.Workflow.WorkflowStatus.RUNNING) ExecutorService(java.util.concurrent.ExecutorService) Before(org.junit.Before) TERMINATED(com.netflix.conductor.common.run.Workflow.WorkflowStatus.TERMINATED) INITIAL_WORKFLOW_INPUT_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.INITIAL_WORKFLOW_INPUT_PATH) ApplicationException(com.netflix.conductor.core.execution.ApplicationException) Uninterruptibles(com.google.common.util.concurrent.Uninterruptibles) Logger(org.slf4j.Logger) WorkflowSweeper(com.netflix.conductor.core.execution.WorkflowSweeper) Assert.assertNotNull(org.junit.Assert.assertNotNull) UserTask(com.netflix.conductor.tests.utils.UserTask) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Assert.assertTrue(org.junit.Assert.assertTrue) WorkflowDef(com.netflix.conductor.common.metadata.workflow.WorkflowDef) FileOutputStream(java.io.FileOutputStream) Test(org.junit.Test) FAILED(com.netflix.conductor.common.metadata.tasks.Task.Status.FAILED) WORKFLOW_OUTPUT_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.WORKFLOW_OUTPUT_PATH) TimeUnit(java.util.concurrent.TimeUnit) DECISION(com.netflix.conductor.common.metadata.workflow.TaskType.DECISION) Assert.assertNull(org.junit.Assert.assertNull) Rule(org.junit.Rule) Ignore(org.junit.Ignore) RetryLogic(com.netflix.conductor.common.metadata.tasks.TaskDef.RetryLogic) TaskType(com.netflix.conductor.common.metadata.workflow.TaskType) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) Task(com.netflix.conductor.common.metadata.tasks.Task) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) UserTask(com.netflix.conductor.tests.utils.UserTask) HashMap(java.util.HashMap) PollData(com.netflix.conductor.common.metadata.tasks.PollData) SubWorkflow(com.netflix.conductor.core.execution.tasks.SubWorkflow) Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Example 7 with SubWorkflow

use of com.netflix.conductor.core.execution.tasks.SubWorkflow in project conductor by Netflix.

the class AbstractWorkflowServiceTest method testTerminateTaskInASubworkflow.

/**
 * This test verifies that a Subworkflow with Terminate task calls decide on parent, and helps progress it immediately.
 */
@Test
public void testTerminateTaskInASubworkflow() {
    WorkflowDef subWorkflowDef = new WorkflowDef();
    subWorkflowDef.setName("test_terminate_task_wf");
    subWorkflowDef.setSchemaVersion(2);
    subWorkflowDef.setVersion(1);
    Map<String, Object> lambdaTaskInputParams = new HashMap<>();
    lambdaTaskInputParams.put("input", "${workflow.input}");
    lambdaTaskInputParams.put("scriptExpression", "if ($.input.a==1){return {testvalue: true}} else{return {testvalue: false}}");
    WorkflowTask lambdaWorkflowTask = new WorkflowTask();
    lambdaWorkflowTask.setWorkflowTaskType(TaskType.LAMBDA);
    lambdaWorkflowTask.setName("lambda");
    lambdaWorkflowTask.setInputParameters(lambdaTaskInputParams);
    lambdaWorkflowTask.setTaskReferenceName("lambda0");
    Map<String, Object> terminateTaskInputParams = new HashMap<>();
    terminateTaskInputParams.put(Terminate.getTerminationStatusParameter(), "COMPLETED");
    terminateTaskInputParams.put(Terminate.getTerminationWorkflowOutputParameter(), "${lambda0.output}");
    WorkflowTask terminateWorkflowTask = new WorkflowTask();
    terminateWorkflowTask.setType(TaskType.TASK_TYPE_TERMINATE);
    terminateWorkflowTask.setName("terminate");
    terminateWorkflowTask.setInputParameters(terminateTaskInputParams);
    terminateWorkflowTask.setTaskReferenceName("terminate0");
    WorkflowTask workflowTask2 = new WorkflowTask();
    workflowTask2.setName("junit_task_2");
    workflowTask2.setTaskReferenceName("t2");
    subWorkflowDef.getTasks().addAll(Arrays.asList(lambdaWorkflowTask, terminateWorkflowTask, workflowTask2));
    assertNotNull(subWorkflowDef);
    metadataService.registerWorkflowDef(subWorkflowDef);
    // Create Parent workflow
    WorkflowDef parentWorkflowDef = new WorkflowDef();
    parentWorkflowDef.setName("test_parent_wf_for_terminate_task_subwf");
    parentWorkflowDef.setSchemaVersion(2);
    WorkflowTask subWorkflowTask = new WorkflowTask();
    subWorkflowTask.setWorkflowTaskType(SUB_WORKFLOW);
    subWorkflowTask.setName("subWF");
    subWorkflowTask.setTaskReferenceName("subWF");
    SubWorkflowParams subWorkflowParams = new SubWorkflowParams();
    subWorkflowParams.setName(subWorkflowDef.getName());
    subWorkflowParams.setVersion(subWorkflowDef.getVersion());
    subWorkflowTask.setSubWorkflowParam(subWorkflowParams);
    parentWorkflowDef.getTasks().addAll(Arrays.asList(subWorkflowTask));
    assertNotNull(parentWorkflowDef);
    metadataService.registerWorkflowDef(parentWorkflowDef);
    Map wfInput = Collections.singletonMap("a", 1);
    String workflowId = startOrLoadWorkflowExecution(parentWorkflowDef.getName(), parentWorkflowDef.getVersion(), "", wfInput, null, null);
    Workflow workflow = workflowExecutor.getWorkflow(workflowId, true);
    assertNotNull(workflow);
    assertEquals(1, workflow.getTasks().size());
    SubWorkflow subWorkflowSystemTask = new SubWorkflow();
    // Simulating SystemTaskWorkerCoordinator to execute async system tasks
    String subWorkflowTaskId = workflow.getTaskByRefName("subWF").getTaskId();
    workflowExecutor.executeSystemTask(subWorkflowSystemTask, subWorkflowTaskId, 1);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    Task task = workflow.getTaskByRefName("subWF");
    Workflow subWorkflow = workflowExecutionService.getExecutionStatus(task.getSubWorkflowId(), true);
    assertNotNull(workflow);
    assertNotNull(task);
    assertEquals(COMPLETED, task.getStatus());
    assertNotNull(subWorkflow);
    assertEquals("tasks:" + workflow.getTasks(), WorkflowStatus.COMPLETED, workflow.getStatus());
    assertEquals("tasks:" + subWorkflow.getTasks(), WorkflowStatus.COMPLETED, subWorkflow.getStatus());
    assertEquals(TaskType.TASK_TYPE_LAMBDA, subWorkflow.getTasks().get(0).getTaskType());
    assertEquals(TaskType.TASK_TYPE_TERMINATE, subWorkflow.getTasks().get(1).getTaskType());
    assertEquals(subWorkflow.getTasks().get(1).getOutputData(), subWorkflow.getOutput());
    assertEquals(SUB_WORKFLOW.name(), workflow.getTasks().get(0).getTaskType());
    metadataService.unregisterWorkflowDef(parentWorkflowDef.getName(), parentWorkflowDef.getVersion());
    metadataService.unregisterWorkflowDef(subWorkflowDef.getName(), subWorkflowDef.getVersion());
}
Also used : SubWorkflow(com.netflix.conductor.core.execution.tasks.SubWorkflow) SubWorkflowParams(com.netflix.conductor.common.metadata.workflow.SubWorkflowParams) Task(com.netflix.conductor.common.metadata.tasks.Task) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) UserTask(com.netflix.conductor.tests.utils.UserTask) WorkflowDef(com.netflix.conductor.common.metadata.workflow.WorkflowDef) HashMap(java.util.HashMap) SubWorkflow(com.netflix.conductor.core.execution.tasks.SubWorkflow) Workflow(com.netflix.conductor.common.run.Workflow) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 8 with SubWorkflow

use of com.netflix.conductor.core.execution.tasks.SubWorkflow in project conductor by Netflix.

the class AbstractWorkflowServiceTest method testSubWorkflowRetry.

@Test
public void testSubWorkflowRetry() {
    String taskName = "junit_task_1";
    TaskDef taskDef = notFoundSafeGetTaskDef(taskName);
    int retryCount = notFoundSafeGetTaskDef(taskName).getRetryCount();
    taskDef.setRetryCount(0);
    metadataService.updateTaskDef(taskDef);
    // create a workflow with sub-workflow
    createSubWorkflow();
    WorkflowDef found = metadataService.getWorkflowDef(WF_WITH_SUB_WF, 1);
    WorkflowTask workflowTask = found.getTasks().stream().filter(t -> t.getType().equals(SUB_WORKFLOW.name())).findAny().orElse(null);
    // Set subworkflow task retry count to 1.
    TaskDef subWorkflowTaskDef = new TaskDef();
    subWorkflowTaskDef.setRetryCount(1);
    subWorkflowTaskDef.setName("test_subworkflow_task");
    subWorkflowTaskDef.setOwnerEmail("test@qbc.com");
    workflowTask.setTaskDefinition(subWorkflowTaskDef);
    metadataService.updateWorkflowDef(found);
    // start the workflow
    Map<String, Object> workflowInputParams = new HashMap<>();
    workflowInputParams.put("param1", "param 1");
    workflowInputParams.put("param3", "param 2");
    workflowInputParams.put("wfName", LINEAR_WORKFLOW_T1_T2);
    String workflowId = startOrLoadWorkflowExecution(WF_WITH_SUB_WF, 1, "test", workflowInputParams, null, null);
    assertNotNull(workflowId);
    Workflow workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    // poll and complete first task
    Task task = workflowExecutionService.poll("junit_task_5", "test");
    assertNotNull(task);
    task.setStatus(COMPLETED);
    workflowExecutionService.updateTask(task);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    // Simulating SystemTaskWorkerCoordinator to execute async system tasks
    String subWorkflowTaskId = workflow.getTaskByRefName("a2").getTaskId();
    workflowExecutor.executeSystemTask(dummySubWorkflowSystemTask, subWorkflowTaskId, 1);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertNotNull(workflow.getTasks());
    assertEquals(2, workflow.getTasks().size());
    task = workflow.getTasks().stream().filter(t -> t.getTaskType().equals(SUB_WORKFLOW.name())).findAny().orElse(null);
    assertNotNull(task);
    assertNotNull(task.getOutputData());
    assertNotNull("Output: " + task.getOutputData().toString() + ", status: " + task.getStatus(), task.getSubWorkflowId());
    String subWorkflowId = task.getSubWorkflowId();
    workflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(workflow);
    assertNotNull(workflow.getTasks());
    assertEquals(workflowId, workflow.getParentWorkflowId());
    assertEquals(RUNNING, workflow.getStatus());
    // poll and fail the first task in sub-workflow
    task = workflowExecutionService.poll("junit_task_1", "test");
    task.setStatus(FAILED);
    workflowExecutionService.updateTask(task);
    Workflow subWorkflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(subWorkflow);
    assertEquals(WorkflowStatus.FAILED, subWorkflow.getStatus());
    subWorkflowTaskId = subWorkflow.getParentWorkflowTaskId();
    workflowExecutor.executeSystemTask(subworkflow, subWorkflowTaskId, 1);
    // Ensure failed Subworkflow task is rescheduled.
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(RUNNING, workflow.getStatus());
    task = workflow.getTasks().stream().filter(t -> t.getTaskType().equals(SUB_WORKFLOW.name())).filter(t -> t.getStatus().equals(SCHEDULED)).findAny().orElse(null);
    assertNotNull(task);
    subWorkflowTaskId = task.getTaskId();
    workflowExecutor.executeSystemTask(subworkflow, task.getTaskId(), 1);
    // Get the latest workflow and task, and then acquire latest subWorkflowId
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    task = workflow.getTasks().stream().filter(t -> t.getTaskType().equals(SUB_WORKFLOW.name())).filter(t -> t.getStatus().equals(IN_PROGRESS)).findAny().orElse(null);
    assertNotNull(task);
    assertNotNull("Retried task in scheduled state shouldn't have a SubworkflowId yet", task.getSubWorkflowId());
    subWorkflowId = task.getSubWorkflowId();
    // poll and fail the first task in sub-workflow
    task = workflowExecutionService.poll("junit_task_1", "test");
    task.setStatus(FAILED);
    workflowExecutionService.updateTask(task);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(WorkflowStatus.FAILED, workflow.getStatus());
    // Retry the failed sub workflow
    workflowExecutor.retry(subWorkflowId, false);
    task = workflowExecutionService.poll("junit_task_1", "test");
    task.setStatus(COMPLETED);
    workflowExecutionService.updateTask(task);
    subWorkflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(subWorkflow);
    assertEquals(RUNNING, subWorkflow.getStatus());
    task = workflowExecutionService.poll("junit_task_2", "test");
    assertEquals(subWorkflowId, task.getWorkflowInstanceId());
    String uuid = UUID.randomUUID().toString();
    task.getOutputData().put("uuid", uuid);
    task.setStatus(COMPLETED);
    workflowExecutionService.updateTask(task);
    subWorkflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(subWorkflow);
    assertEquals(WorkflowStatus.COMPLETED, subWorkflow.getStatus());
    assertNotNull(subWorkflow.getOutput());
    assertTrue(subWorkflow.getOutput().containsKey("o1"));
    assertTrue(subWorkflow.getOutput().containsKey("o2"));
    assertEquals("sub workflow input param1", subWorkflow.getOutput().get("o1"));
    assertEquals(uuid, subWorkflow.getOutput().get("o2"));
    // Simulating SystemTaskWorkerCoordinator
    workflowExecutor.executeSystemTask(subworkflow, subWorkflow.getParentWorkflowTaskId(), 1);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(RUNNING, workflow.getStatus());
    task = workflowExecutionService.poll("junit_task_6", "test");
    assertNotNull(task);
    task.setStatus(COMPLETED);
    workflowExecutionService.updateTask(task);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(WorkflowStatus.COMPLETED, workflow.getStatus());
    // reset retry count
    taskDef = notFoundSafeGetTaskDef(taskName);
    taskDef.setRetryCount(retryCount);
    metadataService.updateTaskDef(taskDef);
    workflowTask = found.getTasks().stream().filter(t -> t.getType().equals(SUB_WORKFLOW.name())).findAny().orElse(null);
    workflowTask.setTaskDefinition(null);
    metadataService.updateWorkflowDef(found);
}
Also used : TaskUtils(com.netflix.conductor.common.utils.TaskUtils) MethodSorters(org.junit.runners.MethodSorters) SubWorkflow(com.netflix.conductor.core.execution.tasks.SubWorkflow) Arrays(java.util.Arrays) TimeoutPolicy(com.netflix.conductor.common.metadata.tasks.TaskDef.TimeoutPolicy) TEMP_FILE_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.TEMP_FILE_PATH) LoggerFactory(org.slf4j.LoggerFactory) Task(com.netflix.conductor.common.metadata.tasks.Task) StringUtils(org.apache.commons.lang3.StringUtils) Future(java.util.concurrent.Future) COMPLETED_WITH_ERRORS(com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED_WITH_ERRORS) RerunWorkflowRequest(com.netflix.conductor.common.metadata.workflow.RerunWorkflowRequest) Workflow(com.netflix.conductor.common.run.Workflow) IN_PROGRESS(com.netflix.conductor.common.metadata.tasks.Task.Status.IN_PROGRESS) Map(java.util.Map) After(org.junit.After) PollData(com.netflix.conductor.common.metadata.tasks.PollData) WorkflowExecutor(com.netflix.conductor.core.execution.WorkflowExecutor) TASK_OUTPUT_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.TASK_OUTPUT_PATH) Terminate(com.netflix.conductor.core.execution.tasks.Terminate) WorkflowRepairService(com.netflix.conductor.core.execution.WorkflowRepairService) TaskDef(com.netflix.conductor.common.metadata.tasks.TaskDef) WorkflowStatus(com.netflix.conductor.common.run.Workflow.WorkflowStatus) MetadataMapperService(com.netflix.conductor.core.metadata.MetadataMapperService) Predicate(java.util.function.Predicate) Set(java.util.Set) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) Executors(java.util.concurrent.Executors) SCHEDULED(com.netflix.conductor.common.metadata.tasks.Task.Status.SCHEDULED) QueueDAO(com.netflix.conductor.dao.QueueDAO) INPUT_PAYLOAD_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.INPUT_PAYLOAD_PATH) List(java.util.List) DynamicForkJoinTaskList(com.netflix.conductor.common.metadata.workflow.DynamicForkJoinTaskList) Assert.assertFalse(org.junit.Assert.assertFalse) TIMED_OUT(com.netflix.conductor.common.metadata.tasks.Task.Status.TIMED_OUT) COMPLETED(com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED) ExecutionService(com.netflix.conductor.service.ExecutionService) FixMethodOrder(org.junit.FixMethodOrder) JsonMapperProvider(com.netflix.conductor.common.utils.JsonMapperProvider) MetadataService(com.netflix.conductor.service.MetadataService) WorkflowContext(com.netflix.conductor.core.WorkflowContext) BeforeClass(org.junit.BeforeClass) SubWorkflowParams(com.netflix.conductor.common.metadata.workflow.SubWorkflowParams) Status(com.netflix.conductor.common.metadata.tasks.Task.Status) HashMap(java.util.HashMap) TaskResult(com.netflix.conductor.common.metadata.tasks.TaskResult) Inject(javax.inject.Inject) SUB_WORKFLOW(com.netflix.conductor.common.metadata.workflow.TaskType.SUB_WORKFLOW) LinkedList(java.util.LinkedList) ExpectedException(org.junit.rules.ExpectedException) RUNNING(com.netflix.conductor.common.run.Workflow.WorkflowStatus.RUNNING) ExecutorService(java.util.concurrent.ExecutorService) Before(org.junit.Before) TERMINATED(com.netflix.conductor.common.run.Workflow.WorkflowStatus.TERMINATED) INITIAL_WORKFLOW_INPUT_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.INITIAL_WORKFLOW_INPUT_PATH) ApplicationException(com.netflix.conductor.core.execution.ApplicationException) Uninterruptibles(com.google.common.util.concurrent.Uninterruptibles) Logger(org.slf4j.Logger) WorkflowSweeper(com.netflix.conductor.core.execution.WorkflowSweeper) Assert.assertNotNull(org.junit.Assert.assertNotNull) UserTask(com.netflix.conductor.tests.utils.UserTask) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Assert.assertTrue(org.junit.Assert.assertTrue) WorkflowDef(com.netflix.conductor.common.metadata.workflow.WorkflowDef) FileOutputStream(java.io.FileOutputStream) Test(org.junit.Test) FAILED(com.netflix.conductor.common.metadata.tasks.Task.Status.FAILED) WORKFLOW_OUTPUT_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.WORKFLOW_OUTPUT_PATH) TimeUnit(java.util.concurrent.TimeUnit) DECISION(com.netflix.conductor.common.metadata.workflow.TaskType.DECISION) Assert.assertNull(org.junit.Assert.assertNull) Rule(org.junit.Rule) Ignore(org.junit.Ignore) RetryLogic(com.netflix.conductor.common.metadata.tasks.TaskDef.RetryLogic) TaskType(com.netflix.conductor.common.metadata.workflow.TaskType) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) Task(com.netflix.conductor.common.metadata.tasks.Task) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) UserTask(com.netflix.conductor.tests.utils.UserTask) WorkflowDef(com.netflix.conductor.common.metadata.workflow.WorkflowDef) HashMap(java.util.HashMap) TaskDef(com.netflix.conductor.common.metadata.tasks.TaskDef) SubWorkflow(com.netflix.conductor.core.execution.tasks.SubWorkflow) Workflow(com.netflix.conductor.common.run.Workflow) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) Test(org.junit.Test)

Example 9 with SubWorkflow

use of com.netflix.conductor.core.execution.tasks.SubWorkflow in project conductor by Netflix.

the class AbstractWorkflowServiceTest method testSubWorkflowRetryLastFailedTask.

@Test
public void testSubWorkflowRetryLastFailedTask() {
    String taskName = "junit_task_2";
    TaskDef taskDef = notFoundSafeGetTaskDef(taskName);
    int retryCount = notFoundSafeGetTaskDef(taskName).getRetryCount();
    taskDef.setRetryCount(0);
    metadataService.updateTaskDef(taskDef);
    createSubWorkflow();
    WorkflowDef found = metadataService.getWorkflowDef(WF_WITH_SUB_WF, 1);
    WorkflowTask workflowTask = found.getTasks().stream().filter(t -> t.getType().equals(SUB_WORKFLOW.name())).findAny().orElse(null);
    TaskDef subWorkflowTaskDef = new TaskDef();
    subWorkflowTaskDef.setRetryCount(0);
    subWorkflowTaskDef.setName("test_subworkflow_task");
    subWorkflowTaskDef.setOwnerEmail("test@qbc.com");
    workflowTask.setTaskDefinition(subWorkflowTaskDef);
    metadataService.updateWorkflowDef(found);
    Map<String, Object> workflowInputParams = new HashMap<>();
    workflowInputParams.put("param1", "param 1");
    workflowInputParams.put("param3", "param 2");
    workflowInputParams.put("wfName", LINEAR_WORKFLOW_T1_T2);
    String workflowId = startOrLoadWorkflowExecution(WF_WITH_SUB_WF, 1, "test", workflowInputParams, null, null);
    assertNotNull(workflowId);
    Workflow workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    Task task = workflowExecutionService.poll("junit_task_5", "test");
    assertNotNull(task);
    task.setStatus(COMPLETED);
    workflowExecutionService.updateTask(task);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    String subWorkflowTaskId = workflow.getTaskByRefName("a2").getTaskId();
    workflowExecutor.executeSystemTask(dummySubWorkflowSystemTask, subWorkflowTaskId, 1);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertNotNull(workflow.getTasks());
    assertEquals(2, workflow.getTasks().size());
    task = workflow.getTasks().stream().filter(t -> t.getTaskType().equals(SUB_WORKFLOW.name())).findAny().orElse(null);
    assertNotNull(task);
    assertNotNull(task.getOutputData());
    assertNotNull("Output: " + task.getOutputData().toString() + ", status: " + task.getStatus(), task.getSubWorkflowId());
    String subWorkflowId = task.getSubWorkflowId();
    workflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(workflow);
    assertNotNull(workflow.getTasks());
    assertEquals(workflowId, workflow.getParentWorkflowId());
    assertEquals(RUNNING, workflow.getStatus());
    task = workflowExecutionService.poll("junit_task_1", "test");
    task.setStatus(COMPLETED);
    workflowExecutionService.updateTask(task);
    Workflow subWorkflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    task = workflowExecutionService.poll("junit_task_2", "test");
    task.setStatus(FAILED);
    workflowExecutionService.updateTask(task);
    subWorkflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(subWorkflow);
    assertEquals(WorkflowStatus.FAILED, subWorkflow.getStatus());
    subWorkflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(subWorkflow);
    task = subWorkflow.getTasks().stream().filter(t -> t.getTaskType().equals("junit_task_2")).findAny().orElse(null);
    assertNotNull(task);
    assertEquals(FAILED, task.getStatus());
    subWorkflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(subWorkflow);
    assertEquals(WorkflowStatus.FAILED, subWorkflow.getStatus());
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(WorkflowStatus.FAILED, workflow.getStatus());
    workflowExecutor.retry(workflowId, true);
    subWorkflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(subWorkflow);
    assertEquals(RUNNING, subWorkflow.getStatus());
    task = workflowExecutionService.poll("junit_task_2", "test");
    assertEquals(subWorkflowId, task.getWorkflowInstanceId());
    String uuid = UUID.randomUUID().toString();
    task.getOutputData().put("uuid", uuid);
    task.setStatus(COMPLETED);
    workflowExecutionService.updateTask(task);
    subWorkflow = workflowExecutionService.getExecutionStatus(subWorkflowId, true);
    assertNotNull(subWorkflow);
    assertEquals(WorkflowStatus.COMPLETED, subWorkflow.getStatus());
    assertNotNull(subWorkflow.getOutput());
    assertTrue(subWorkflow.getOutput().containsKey("o1"));
    assertTrue(subWorkflow.getOutput().containsKey("o2"));
    assertEquals("sub workflow input param1", subWorkflow.getOutput().get("o1"));
    assertEquals(uuid, subWorkflow.getOutput().get("o2"));
    workflowExecutor.executeSystemTask(subworkflow, subWorkflow.getParentWorkflowTaskId(), 1);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(RUNNING, workflow.getStatus());
    task = workflowExecutionService.poll("junit_task_6", "test");
    assertNotNull(task);
    task.setStatus(COMPLETED);
    workflowExecutionService.updateTask(task);
    workflow = workflowExecutionService.getExecutionStatus(workflowId, true);
    assertNotNull(workflow);
    assertEquals(WorkflowStatus.COMPLETED, workflow.getStatus());
    taskDef = notFoundSafeGetTaskDef(taskName);
    taskDef.setRetryCount(retryCount);
    metadataService.updateTaskDef(taskDef);
    workflowTask = found.getTasks().stream().filter(t -> t.getType().equals(SUB_WORKFLOW.name())).findAny().orElse(null);
    workflowTask.setTaskDefinition(null);
    metadataService.updateWorkflowDef(found);
}
Also used : TaskUtils(com.netflix.conductor.common.utils.TaskUtils) MethodSorters(org.junit.runners.MethodSorters) SubWorkflow(com.netflix.conductor.core.execution.tasks.SubWorkflow) Arrays(java.util.Arrays) TimeoutPolicy(com.netflix.conductor.common.metadata.tasks.TaskDef.TimeoutPolicy) TEMP_FILE_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.TEMP_FILE_PATH) LoggerFactory(org.slf4j.LoggerFactory) Task(com.netflix.conductor.common.metadata.tasks.Task) StringUtils(org.apache.commons.lang3.StringUtils) Future(java.util.concurrent.Future) COMPLETED_WITH_ERRORS(com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED_WITH_ERRORS) RerunWorkflowRequest(com.netflix.conductor.common.metadata.workflow.RerunWorkflowRequest) Workflow(com.netflix.conductor.common.run.Workflow) IN_PROGRESS(com.netflix.conductor.common.metadata.tasks.Task.Status.IN_PROGRESS) Map(java.util.Map) After(org.junit.After) PollData(com.netflix.conductor.common.metadata.tasks.PollData) WorkflowExecutor(com.netflix.conductor.core.execution.WorkflowExecutor) TASK_OUTPUT_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.TASK_OUTPUT_PATH) Terminate(com.netflix.conductor.core.execution.tasks.Terminate) WorkflowRepairService(com.netflix.conductor.core.execution.WorkflowRepairService) TaskDef(com.netflix.conductor.common.metadata.tasks.TaskDef) WorkflowStatus(com.netflix.conductor.common.run.Workflow.WorkflowStatus) MetadataMapperService(com.netflix.conductor.core.metadata.MetadataMapperService) Predicate(java.util.function.Predicate) Set(java.util.Set) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) Executors(java.util.concurrent.Executors) SCHEDULED(com.netflix.conductor.common.metadata.tasks.Task.Status.SCHEDULED) QueueDAO(com.netflix.conductor.dao.QueueDAO) INPUT_PAYLOAD_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.INPUT_PAYLOAD_PATH) List(java.util.List) DynamicForkJoinTaskList(com.netflix.conductor.common.metadata.workflow.DynamicForkJoinTaskList) Assert.assertFalse(org.junit.Assert.assertFalse) TIMED_OUT(com.netflix.conductor.common.metadata.tasks.Task.Status.TIMED_OUT) COMPLETED(com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED) ExecutionService(com.netflix.conductor.service.ExecutionService) FixMethodOrder(org.junit.FixMethodOrder) JsonMapperProvider(com.netflix.conductor.common.utils.JsonMapperProvider) MetadataService(com.netflix.conductor.service.MetadataService) WorkflowContext(com.netflix.conductor.core.WorkflowContext) BeforeClass(org.junit.BeforeClass) SubWorkflowParams(com.netflix.conductor.common.metadata.workflow.SubWorkflowParams) Status(com.netflix.conductor.common.metadata.tasks.Task.Status) HashMap(java.util.HashMap) TaskResult(com.netflix.conductor.common.metadata.tasks.TaskResult) Inject(javax.inject.Inject) SUB_WORKFLOW(com.netflix.conductor.common.metadata.workflow.TaskType.SUB_WORKFLOW) LinkedList(java.util.LinkedList) ExpectedException(org.junit.rules.ExpectedException) RUNNING(com.netflix.conductor.common.run.Workflow.WorkflowStatus.RUNNING) ExecutorService(java.util.concurrent.ExecutorService) Before(org.junit.Before) TERMINATED(com.netflix.conductor.common.run.Workflow.WorkflowStatus.TERMINATED) INITIAL_WORKFLOW_INPUT_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.INITIAL_WORKFLOW_INPUT_PATH) ApplicationException(com.netflix.conductor.core.execution.ApplicationException) Uninterruptibles(com.google.common.util.concurrent.Uninterruptibles) Logger(org.slf4j.Logger) WorkflowSweeper(com.netflix.conductor.core.execution.WorkflowSweeper) Assert.assertNotNull(org.junit.Assert.assertNotNull) UserTask(com.netflix.conductor.tests.utils.UserTask) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Assert.assertTrue(org.junit.Assert.assertTrue) WorkflowDef(com.netflix.conductor.common.metadata.workflow.WorkflowDef) FileOutputStream(java.io.FileOutputStream) Test(org.junit.Test) FAILED(com.netflix.conductor.common.metadata.tasks.Task.Status.FAILED) WORKFLOW_OUTPUT_PATH(com.netflix.conductor.tests.utils.MockExternalPayloadStorage.WORKFLOW_OUTPUT_PATH) TimeUnit(java.util.concurrent.TimeUnit) DECISION(com.netflix.conductor.common.metadata.workflow.TaskType.DECISION) Assert.assertNull(org.junit.Assert.assertNull) Rule(org.junit.Rule) Ignore(org.junit.Ignore) RetryLogic(com.netflix.conductor.common.metadata.tasks.TaskDef.RetryLogic) TaskType(com.netflix.conductor.common.metadata.workflow.TaskType) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) Task(com.netflix.conductor.common.metadata.tasks.Task) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) UserTask(com.netflix.conductor.tests.utils.UserTask) WorkflowDef(com.netflix.conductor.common.metadata.workflow.WorkflowDef) HashMap(java.util.HashMap) TaskDef(com.netflix.conductor.common.metadata.tasks.TaskDef) SubWorkflow(com.netflix.conductor.core.execution.tasks.SubWorkflow) Workflow(com.netflix.conductor.common.run.Workflow) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) Test(org.junit.Test)

Example 10 with SubWorkflow

use of com.netflix.conductor.core.execution.tasks.SubWorkflow in project conductor by Netflix.

the class TestWorkflowExecutor method testRetryFromLastFailedSubWorkflowTaskThenStartWithLastFailedTask.

@Test
public void testRetryFromLastFailedSubWorkflowTaskThenStartWithLastFailedTask() {
    // given
    String id = IDGenerator.generate();
    String workflowInstanceId = IDGenerator.generate();
    Task task = new Task();
    task.setTaskType(TaskType.SIMPLE.name());
    task.setTaskDefName("task");
    task.setReferenceTaskName("task_ref");
    task.setWorkflowInstanceId(workflowInstanceId);
    task.setScheduledTime(System.currentTimeMillis());
    task.setTaskId(IDGenerator.generate());
    task.setStatus(Status.COMPLETED);
    task.setRetryCount(0);
    task.setWorkflowTask(new WorkflowTask());
    task.setOutputData(new HashMap<>());
    task.setSubWorkflowId(id);
    task.setSeq(1);
    Task task1 = new Task();
    task1.setTaskType(TaskType.SIMPLE.name());
    task1.setTaskDefName("task1");
    task1.setReferenceTaskName("task1_ref");
    task1.setWorkflowInstanceId(workflowInstanceId);
    task1.setScheduledTime(System.currentTimeMillis());
    task1.setTaskId(IDGenerator.generate());
    task1.setStatus(Status.FAILED);
    task1.setRetryCount(0);
    task1.setWorkflowTask(new WorkflowTask());
    task1.setOutputData(new HashMap<>());
    task1.setSubWorkflowId(id);
    task1.setSeq(2);
    Workflow subWorkflow = new Workflow();
    subWorkflow.setWorkflowId(id);
    subWorkflow.setStatus(Workflow.WorkflowStatus.FAILED);
    subWorkflow.setTasks(Lists.newArrayList(task, task1));
    subWorkflow.setParentWorkflowId("testRunWorkflowId");
    Task task2 = new Task();
    task2.setWorkflowInstanceId(subWorkflow.getWorkflowId());
    task2.setScheduledTime(System.currentTimeMillis());
    task2.setTaskId(IDGenerator.generate());
    task2.setStatus(Status.FAILED);
    task2.setRetryCount(0);
    task2.setOutputData(new HashMap<>());
    task2.setSubWorkflowId(id);
    task2.setTaskType(TaskType.SUB_WORKFLOW.name());
    Workflow workflow = new Workflow();
    workflow.setWorkflowId("testRunWorkflowId");
    workflow.setStatus(Workflow.WorkflowStatus.FAILED);
    workflow.setTasks(Collections.singletonList(task2));
    WorkflowDef workflowDef = new WorkflowDef();
    workflowDef.setName("first_workflow");
    workflow.setWorkflowDefinition(workflowDef);
    // when
    when(executionDAOFacade.getWorkflowById(workflow.getWorkflowId(), true)).thenReturn(workflow);
    when(executionDAOFacade.getWorkflowById(task.getSubWorkflowId(), true)).thenReturn(subWorkflow);
    when(metadataDAO.getWorkflowDef(anyString(), anyInt())).thenReturn(Optional.of(workflowDef));
    when(executionDAOFacade.getTaskById(subWorkflow.getParentWorkflowTaskId())).thenReturn(task1);
    when(executionDAOFacade.getWorkflowById(subWorkflow.getParentWorkflowId(), false)).thenReturn(workflow);
    workflowExecutor.retry(workflow.getWorkflowId(), true);
    // then
    assertEquals(task.getStatus(), Status.COMPLETED);
    assertEquals(task1.getStatus(), Status.IN_PROGRESS);
    assertEquals(workflow.getStatus(), WorkflowStatus.RUNNING);
    assertEquals(subWorkflow.getStatus(), WorkflowStatus.RUNNING);
}
Also used : Task(com.netflix.conductor.common.metadata.tasks.Task) WorkflowSystemTask(com.netflix.conductor.core.execution.tasks.WorkflowSystemTask) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) WorkflowDef(com.netflix.conductor.common.metadata.workflow.WorkflowDef) SubWorkflow(com.netflix.conductor.core.execution.tasks.SubWorkflow) Workflow(com.netflix.conductor.common.run.Workflow) WorkflowTask(com.netflix.conductor.common.metadata.workflow.WorkflowTask) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Aggregations

SubWorkflow (com.netflix.conductor.core.execution.tasks.SubWorkflow)21 Task (com.netflix.conductor.common.metadata.tasks.Task)20 WorkflowTask (com.netflix.conductor.common.metadata.workflow.WorkflowTask)19 Workflow (com.netflix.conductor.common.run.Workflow)19 Test (org.junit.Test)16 UserTask (com.netflix.conductor.tests.utils.UserTask)13 HashMap (java.util.HashMap)13 WorkflowDef (com.netflix.conductor.common.metadata.workflow.WorkflowDef)12 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 TaskResult (com.netflix.conductor.common.metadata.tasks.TaskResult)8 RerunWorkflowRequest (com.netflix.conductor.common.metadata.workflow.RerunWorkflowRequest)8 SubWorkflowParams (com.netflix.conductor.common.metadata.workflow.SubWorkflowParams)8 JsonMapperProvider (com.netflix.conductor.common.utils.JsonMapperProvider)8 Uninterruptibles (com.google.common.util.concurrent.Uninterruptibles)7 PollData (com.netflix.conductor.common.metadata.tasks.PollData)7 Status (com.netflix.conductor.common.metadata.tasks.Task.Status)7 COMPLETED (com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED)7 COMPLETED_WITH_ERRORS (com.netflix.conductor.common.metadata.tasks.Task.Status.COMPLETED_WITH_ERRORS)7 FAILED (com.netflix.conductor.common.metadata.tasks.Task.Status.FAILED)7 IN_PROGRESS (com.netflix.conductor.common.metadata.tasks.Task.Status.IN_PROGRESS)7