Search in sources :

Example 1 with NodeError

use of org.flyte.api.v1.NodeError in project flytekit-java by flyteorg.

the class ProtoUtilTest method shouldSerializeNodeError.

@Test
void shouldSerializeNodeError() {
    NodeError error = NodeError.builder().failedNodeId("node-1").message("Internal error").build();
    Types.Error proto = ProtoUtil.serialize(error);
    assertThat(proto, equalTo(Types.Error.newBuilder().setFailedNodeId("node-1").setMessage("Internal error").build()));
}
Also used : NodeError(org.flyte.api.v1.NodeError) Types(flyteidl.core.Types) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with NodeError

use of org.flyte.api.v1.NodeError in project flytekit-java by flyteorg.

the class SdkBranchNode method toIdl.

@Override
public Node toIdl() {
    NodeError nodeError = NodeError.builder().failedNodeId(nodeId).message("No cases matched").build();
    Map<String, Binding> extraInputs = new HashMap<>();
    @Var IfElseBlock ifElseBlock = IfBlockIdl.toIdl(ifElse, extraInputs);
    if (ifElseBlock.elseNode() == null) {
        ifElseBlock = ifElseBlock.toBuilder().error(nodeError).build();
    }
    return Node.builder().id(nodeId).branchNode(BranchNode.builder().ifElse(ifElseBlock).build()).inputs(unmodifiableList(new ArrayList<>(extraInputs.values()))).upstreamNodeIds(upstreamNodeIds).build();
}
Also used : NodeError(org.flyte.api.v1.NodeError) Binding(org.flyte.api.v1.Binding) IfElseBlock(org.flyte.api.v1.IfElseBlock) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Var(com.google.errorprone.annotations.Var) ArrayList(java.util.ArrayList)

Aggregations

NodeError (org.flyte.api.v1.NodeError)2 Var (com.google.errorprone.annotations.Var)1 Types (flyteidl.core.Types)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Binding (org.flyte.api.v1.Binding)1 IfElseBlock (org.flyte.api.v1.IfElseBlock)1 Test (org.junit.jupiter.api.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1