Search in sources :

Example 1 with ListWorkflow

use of org.flyte.localengine.examples.ListWorkflow in project flytekit-java by flyteorg.

the class LocalEngineTest method testBindingCollection.

@Test
public void testBindingCollection() {
    String workflowName = new ListWorkflow().getName();
    Map<String, WorkflowTemplate> workflows = loadWorkflows();
    Map<String, RunnableTask> tasks = loadTasks();
    WorkflowTemplate workflow = workflows.get(workflowName);
    Map<String, Literal> outputs = LocalEngine.compileAndExecute(workflow, tasks, emptyMap(), ImmutableMap.of());
    // 3 = 1 + 2, 7 = 3 + 4
    Literal i3 = Literal.ofScalar(Scalar.ofPrimitive(Primitive.ofIntegerValue(3)));
    Literal i7 = Literal.ofScalar(Scalar.ofPrimitive(Primitive.ofIntegerValue(7)));
    assertEquals(ImmutableMap.of("list", Literal.ofCollection(ImmutableList.of(i3, i7))), outputs);
}
Also used : WorkflowTemplate(org.flyte.api.v1.WorkflowTemplate) Literal(org.flyte.api.v1.Literal) RunnableTask(org.flyte.api.v1.RunnableTask) ListWorkflow(org.flyte.localengine.examples.ListWorkflow) Test(org.junit.jupiter.api.Test)

Aggregations

Literal (org.flyte.api.v1.Literal)1 RunnableTask (org.flyte.api.v1.RunnableTask)1 WorkflowTemplate (org.flyte.api.v1.WorkflowTemplate)1 ListWorkflow (org.flyte.localengine.examples.ListWorkflow)1 Test (org.junit.jupiter.api.Test)1