Skip to content

Commit

Permalink
Integration test it
Browse files Browse the repository at this point in the history
Signed-off-by: Hongxin Liang <[email protected]>
  • Loading branch information
honnix committed Sep 28, 2023
1 parent d898c22 commit b41ae51
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@
*/
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;
import org.flyte.examples.SumTask.SumInput;
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;

Expand Down Expand Up @@ -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<Void> hello =
builder.apply(
"hello",
SdkRemoteTask.create(
DOMAIN,
PROJECT,
HelloWorldTask.class.getName(),
SdkTypes.nulls(),
SdkTypes.nulls()));
@Var SdkBindingData<Long> prev = SdkBindingDataFactory.of(0);
@Var SdkBindingData<Long> value = SdkBindingDataFactory.of(1);
for (int i = 2; i <= input.n().get(); i++) {
SdkBindingData<Long> 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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

public class FlyteSandboxContainer extends GenericContainer<FlyteSandboxContainer> {

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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class JFlyteContainer extends GenericContainer<JFlyteContainer> {
static final String IMAGE_NAME;
static final Map<String, String> envVars =
ImmutableMap.<String, String>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")
Expand Down
2 changes: 1 addition & 1 deletion jflyte/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
<environment>
<FLYTE_INTERNAL_MODULE_DIR>/jflyte/modules</FLYTE_INTERNAL_MODULE_DIR>
<FLYTE_INTERNAL_IMAGE>${docker.image}:${docker.tag}</FLYTE_INTERNAL_IMAGE>
<FLYTE_PLATFORM_URL>flyte:30081</FLYTE_PLATFORM_URL>
<FLYTE_PLATFORM_URL>flyteadmin.flyte.svc.cluster.local:81</FLYTE_PLATFORM_URL>
<FLYTE_PLATFORM_INSECURE>True</FLYTE_PLATFORM_INSECURE>
</environment>
<jvmFlags>
Expand Down

0 comments on commit b41ae51

Please sign in to comment.