Search in sources :

Example 1 with StructWorkflow

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

the class LocalEngineTest method testStructWorkflow.

@Test
public void testStructWorkflow() {
    String workflowName = new StructWorkflow().getName();
    Map<String, WorkflowTemplate> workflows = loadWorkflows();
    Map<String, RunnableTask> tasks = loadTasks();
    WorkflowTemplate workflow = workflows.get(workflowName);
    Literal inputStructLiteral = Literal.ofScalar(Scalar.ofGeneric(Struct.of(ImmutableMap.of("someKey1", Struct.Value.ofStringValue("some_value_1"), "someKey2", Struct.Value.ofBoolValue(true)))));
    Map<String, Literal> inputs = ImmutableMap.of("someString", Literal.ofScalar(Scalar.ofPrimitive(Primitive.ofStringValue("some_string_value"))), "someStruct", inputStructLiteral);
    Map<String, Literal> outputs = LocalEngine.compileAndExecute(workflow, tasks, emptyMap(), inputs);
    Literal expectedOutput = Literal.ofScalar(Scalar.ofGeneric(Struct.of(ImmutableMap.of("someKey1", Struct.Value.ofStringValue("some_value_1-output"), "someKey2", Struct.Value.ofBoolValue(true)))));
    assertEquals(expectedOutput, outputs.get("outputStructData"));
}
Also used : StructWorkflow(org.flyte.localengine.examples.StructWorkflow) WorkflowTemplate(org.flyte.api.v1.WorkflowTemplate) Literal(org.flyte.api.v1.Literal) RunnableTask(org.flyte.api.v1.RunnableTask) 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 StructWorkflow (org.flyte.localengine.examples.StructWorkflow)1 Test (org.junit.jupiter.api.Test)1