Search in sources :

Example 1 with MapWorkflow

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

the class LocalEngineTest method testBindingMap.

@Test
public void testBindingMap() {
    String workflowName = new MapWorkflow().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("map", Literal.ofMap(ImmutableMap.of("e", i3, "f", i7))), outputs);
}
Also used : WorkflowTemplate(org.flyte.api.v1.WorkflowTemplate) Literal(org.flyte.api.v1.Literal) RunnableTask(org.flyte.api.v1.RunnableTask) MapWorkflow(org.flyte.localengine.examples.MapWorkflow) 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 MapWorkflow (org.flyte.localengine.examples.MapWorkflow)1 Test (org.junit.jupiter.api.Test)1