Search in sources :

Example 21 with WorkflowSummary

use of com.netflix.conductor.common.run.WorkflowSummary in project conductor by Netflix.

the class TestElasticSearchRestDAOV6 method shouldAsyncUpdateWorkflow.

@Test
public void shouldAsyncUpdateWorkflow() throws Exception {
    Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
    WorkflowSummary summary = new WorkflowSummary(workflow);
    indexDAO.indexWorkflow(workflow);
    indexDAO.asyncUpdateWorkflow(workflow.getWorkflowId(), new String[] { "status" }, new Object[] { Workflow.WorkflowStatus.FAILED }).get();
    summary.setStatus(Workflow.WorkflowStatus.FAILED);
    assertWorkflowSummary(workflow.getWorkflowId(), summary);
}
Also used : WorkflowSummary(com.netflix.conductor.common.run.WorkflowSummary) Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Example 22 with WorkflowSummary

use of com.netflix.conductor.common.run.WorkflowSummary in project conductor by Netflix.

the class TestElasticSearchRestDAOV6 method shouldIndexWorkflowAsync.

@Test
public void shouldIndexWorkflowAsync() throws Exception {
    Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
    WorkflowSummary summary = new WorkflowSummary(workflow);
    indexDAO.asyncIndexWorkflow(workflow).get();
    assertWorkflowSummary(workflow.getWorkflowId(), summary);
}
Also used : WorkflowSummary(com.netflix.conductor.common.run.WorkflowSummary) Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Example 23 with WorkflowSummary

use of com.netflix.conductor.common.run.WorkflowSummary in project conductor by Netflix.

the class AbstractProtoMapper method fromProto.

public WorkflowSummary fromProto(WorkflowSummaryPb.WorkflowSummary from) {
    WorkflowSummary to = new WorkflowSummary();
    to.setWorkflowType(from.getWorkflowType());
    to.setVersion(from.getVersion());
    to.setWorkflowId(from.getWorkflowId());
    to.setCorrelationId(from.getCorrelationId());
    to.setStartTime(from.getStartTime());
    to.setUpdateTime(from.getUpdateTime());
    to.setEndTime(from.getEndTime());
    to.setStatus(fromProto(from.getStatus()));
    to.setInput(from.getInput());
    to.setOutput(from.getOutput());
    to.setReasonForIncompletion(from.getReasonForIncompletion());
    to.setExecutionTime(from.getExecutionTime());
    to.setEvent(from.getEvent());
    to.setFailedReferenceTaskNames(from.getFailedReferenceTaskNames());
    to.setExternalInputPayloadStoragePath(from.getExternalInputPayloadStoragePath());
    to.setExternalOutputPayloadStoragePath(from.getExternalOutputPayloadStoragePath());
    to.setPriority(from.getPriority());
    return to;
}
Also used : WorkflowSummary(com.netflix.conductor.common.run.WorkflowSummary)

Example 24 with WorkflowSummary

use of com.netflix.conductor.common.run.WorkflowSummary in project conductor by Netflix.

the class WorkflowServiceImplTest method searchByTasksTest.

@Test
public void searchByTasksTest() throws InterruptedException {
    CountDownLatch streamAlive = new CountDownLatch(1);
    AtomicReference<WorkflowServicePb.WorkflowSummarySearchResult> result = new AtomicReference<>();
    SearchPb.Request req = SearchPb.Request.newBuilder().setStart(1).setSize(1).setSort("strings").setQuery("").setFreeText("").build();
    StreamObserver<WorkflowServicePb.WorkflowSummarySearchResult> streamObserver = new StreamObserver<WorkflowServicePb.WorkflowSummarySearchResult>() {

        @Override
        public void onNext(WorkflowServicePb.WorkflowSummarySearchResult value) {
            result.set(value);
        }

        @Override
        public void onError(Throwable t) {
            streamAlive.countDown();
        }

        @Override
        public void onCompleted() {
            streamAlive.countDown();
        }
    };
    WorkflowSummary workflow = new WorkflowSummary();
    SearchResult<WorkflowSummary> searchResult = new SearchResult<>();
    searchResult.setTotalHits(1);
    searchResult.setResults(Collections.singletonList(workflow));
    when(workflowService.searchWorkflowsByTasks(anyInt(), anyInt(), anyList(), anyString(), anyString())).thenReturn(searchResult);
    workflowServiceImpl.searchByTasks(req, streamObserver);
    streamAlive.await(10, TimeUnit.MILLISECONDS);
    WorkflowServicePb.WorkflowSummarySearchResult workflowSearchResult = result.get();
    assertEquals(1, workflowSearchResult.getTotalHits());
    assertEquals(WorkflowSummaryPb.WorkflowSummary.newBuilder().build(), workflowSearchResult.getResultsList().get(0));
}
Also used : StreamObserver(io.grpc.stub.StreamObserver) WorkflowSummary(com.netflix.conductor.common.run.WorkflowSummary) SearchPb(com.netflix.conductor.grpc.SearchPb) AtomicReference(java.util.concurrent.atomic.AtomicReference) SearchResult(com.netflix.conductor.common.run.SearchResult) CountDownLatch(java.util.concurrent.CountDownLatch) WorkflowServicePb(com.netflix.conductor.grpc.WorkflowServicePb) Test(org.junit.Test)

Example 25 with WorkflowSummary

use of com.netflix.conductor.common.run.WorkflowSummary in project conductor by Netflix.

the class TestElasticSearchRestDAOV7 method shouldUpdateWorkflow.

@Test
public void shouldUpdateWorkflow() {
    Workflow workflow = TestUtils.loadWorkflowSnapshot("workflow");
    WorkflowSummary summary = new WorkflowSummary(workflow);
    indexDAO.indexWorkflow(workflow);
    indexDAO.updateWorkflow(workflow.getWorkflowId(), new String[] { "status" }, new Object[] { Workflow.WorkflowStatus.COMPLETED });
    summary.setStatus(Workflow.WorkflowStatus.COMPLETED);
    assertWorkflowSummary(workflow.getWorkflowId(), summary);
}
Also used : WorkflowSummary(com.netflix.conductor.common.run.WorkflowSummary) Workflow(com.netflix.conductor.common.run.Workflow) Test(org.junit.Test)

Aggregations

WorkflowSummary (com.netflix.conductor.common.run.WorkflowSummary)30 Test (org.junit.Test)22 Workflow (com.netflix.conductor.common.run.Workflow)19 SearchResult (com.netflix.conductor.common.run.SearchResult)7 ApplicationException (com.netflix.conductor.core.execution.ApplicationException)6 IOException (java.io.IOException)5 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)5 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)4 Task (com.netflix.conductor.common.metadata.tasks.Task)4 WorkflowDef (com.netflix.conductor.common.metadata.workflow.WorkflowDef)4 Message (com.netflix.conductor.core.events.queue.Message)4 ParserException (com.netflix.conductor.elasticsearch.query.parser.ParserException)4 TaskResult (com.netflix.conductor.common.metadata.tasks.TaskResult)3 WorkflowTask (com.netflix.conductor.common.metadata.workflow.WorkflowTask)3 Collections (java.util.Collections)3 LinkedList (java.util.LinkedList)3 TaskDef (com.netflix.conductor.common.metadata.tasks.TaskDef)2 StartWorkflowRequest (com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest)2 SearchPb (com.netflix.conductor.grpc.SearchPb)2 WorkflowServicePb (com.netflix.conductor.grpc.WorkflowServicePb)2