From b41ae515ec7cb0131641efa686380dc56ab5a529 Mon Sep 17 00:00:00 2001 From: Hongxin Liang Date: Thu, 28 Sep 2023 11:14:15 +0200 Subject: [PATCH] Integration test it Signed-off-by: Hongxin Liang --- .../DynamicFibonacciWorkflowTask.java | 20 +++++++++++++- .../org/flyte/examples/FlyteEnvironment.java | 27 +++++++++++++++++++ .../org/flyte/utils/FlyteSandboxClient.java | 5 ++-- .../flyte/utils/FlyteSandboxContainer.java | 2 +- .../java/org/flyte/utils/JFlyteContainer.java | 2 ++ jflyte/pom.xml | 2 +- 6 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 flytekit-examples/src/main/java/org/flyte/examples/FlyteEnvironment.java diff --git a/flytekit-examples/src/main/java/org/flyte/examples/DynamicFibonacciWorkflowTask.java b/flytekit-examples/src/main/java/org/flyte/examples/DynamicFibonacciWorkflowTask.java index 9ed60da68..577d8a3da 100644 --- a/flytekit-examples/src/main/java/org/flyte/examples/DynamicFibonacciWorkflowTask.java +++ b/flytekit-examples/src/main/java/org/flyte/examples/DynamicFibonacciWorkflowTask.java @@ -16,6 +16,9 @@ */ package org.flyte.examples; +import static org.flyte.examples.FlyteEnvironment.DOMAIN; +import static org.flyte.examples.FlyteEnvironment.PROJECT; + import com.google.auto.service.AutoService; import com.google.auto.value.AutoValue; import com.google.errorprone.annotations.Var; @@ -23,6 +26,9 @@ import org.flyte.flytekit.SdkBindingData; import org.flyte.flytekit.SdkBindingDataFactory; import org.flyte.flytekit.SdkDynamicWorkflowTask; +import org.flyte.flytekit.SdkNode; +import org.flyte.flytekit.SdkRemoteTask; +import org.flyte.flytekit.SdkTypes; import org.flyte.flytekit.SdkWorkflowBuilder; import org.flyte.flytekit.jackson.JacksonSdkType; @@ -59,11 +65,23 @@ public Output run(SdkWorkflowBuilder builder, Input input) { } else if (input.n().get() == 0) { return Output.create(SdkBindingDataFactory.of(0)); } else { + SdkNode hello = + builder.apply( + "hello", + SdkRemoteTask.create( + DOMAIN, + PROJECT, + HelloWorldTask.class.getName(), + SdkTypes.nulls(), + SdkTypes.nulls())); @Var SdkBindingData prev = SdkBindingDataFactory.of(0); @Var SdkBindingData value = SdkBindingDataFactory.of(1); for (int i = 2; i <= input.n().get(); i++) { SdkBindingData next = - builder.apply("fib-" + i, new SumTask(), SumInput.create(value, prev)).getOutputs(); + builder + .apply( + "fib-" + i, new SumTask().withUpstreamNode(hello), SumInput.create(value, prev)) + .getOutputs(); prev = value; value = next; } diff --git a/flytekit-examples/src/main/java/org/flyte/examples/FlyteEnvironment.java b/flytekit-examples/src/main/java/org/flyte/examples/FlyteEnvironment.java new file mode 100644 index 000000000..67fa76916 --- /dev/null +++ b/flytekit-examples/src/main/java/org/flyte/examples/FlyteEnvironment.java @@ -0,0 +1,27 @@ +/* + * Copyright 2021 Flyte Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.flyte.examples; + +public final class FlyteEnvironment { + + public static final String DOMAIN = "development"; + public static final String PROJECT = "flytesnacks"; + + private FlyteEnvironment() { + throw new UnsupportedOperationException(); + } +} diff --git a/integration-tests/src/test/java/org/flyte/utils/FlyteSandboxClient.java b/integration-tests/src/test/java/org/flyte/utils/FlyteSandboxClient.java index d212295f2..3bbfd0a95 100644 --- a/integration-tests/src/test/java/org/flyte/utils/FlyteSandboxClient.java +++ b/integration-tests/src/test/java/org/flyte/utils/FlyteSandboxClient.java @@ -16,6 +16,9 @@ */ package org.flyte.utils; +import static org.flyte.examples.FlyteEnvironment.DOMAIN; +import static org.flyte.examples.FlyteEnvironment.PROJECT; + import flyteidl.admin.ExecutionOuterClass; import flyteidl.core.Execution; import flyteidl.core.IdentifierOuterClass; @@ -28,8 +31,6 @@ import org.rnorth.ducttape.unreliables.Unreliables; public class FlyteSandboxClient { - private static final String DOMAIN = "development"; - private static final String PROJECT = "flytesnacks"; private static final int EXECUTION_TIMEOUT_SECONDS = 300; private final String version; diff --git a/integration-tests/src/test/java/org/flyte/utils/FlyteSandboxContainer.java b/integration-tests/src/test/java/org/flyte/utils/FlyteSandboxContainer.java index b78d2d676..d66bec74f 100644 --- a/integration-tests/src/test/java/org/flyte/utils/FlyteSandboxContainer.java +++ b/integration-tests/src/test/java/org/flyte/utils/FlyteSandboxContainer.java @@ -33,7 +33,7 @@ public class FlyteSandboxContainer extends GenericContainer { - public static final String IMAGE_NAME = "ghcr.io/flyteorg/flyte-sandbox:v1.1.0"; + public static final String IMAGE_NAME = "ghcr.io/flyteorg/flyte-sandbox:v1.9.1"; public static final FlyteSandboxContainer INSTANCE = new FlyteSandboxContainer() diff --git a/integration-tests/src/test/java/org/flyte/utils/JFlyteContainer.java b/integration-tests/src/test/java/org/flyte/utils/JFlyteContainer.java index c85cab1a6..0b5126d92 100644 --- a/integration-tests/src/test/java/org/flyte/utils/JFlyteContainer.java +++ b/integration-tests/src/test/java/org/flyte/utils/JFlyteContainer.java @@ -30,6 +30,8 @@ class JFlyteContainer extends GenericContainer { static final String IMAGE_NAME; static final Map envVars = ImmutableMap.builder() + .put("FLYTE_PLATFORM_URL", "flyte:30081") + .put("FLYTE_PLATFORM_INSECURE", "True") .put("FLYTE_AWS_ENDPOINT", "http://flyte:30084") .put("FLYTE_AWS_ACCESS_KEY_ID", "minio") .put("FLYTE_AWS_SECRET_ACCESS_KEY", "miniostorage") diff --git a/jflyte/pom.xml b/jflyte/pom.xml index b2c0d8972..ffcb79793 100644 --- a/jflyte/pom.xml +++ b/jflyte/pom.xml @@ -200,7 +200,7 @@ /jflyte/modules ${docker.image}:${docker.tag} - flyte:30081 + flyteadmin.flyte.svc.cluster.local:81 True