org.flyte.examples.AllInputsWorkflow Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flytekit-examples Show documentation
Show all versions of flytekit-examples Show documentation
Examples of Tasks, Workflows and Launch plans written in Java.
/*
* 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;
import com.google.auto.service.AutoService;
import com.google.auto.value.AutoValue;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.flyte.examples.AllInputsTask.AutoAllInputsOutput;
import org.flyte.flytekit.SdkBindingData;
import org.flyte.flytekit.SdkBindingDataFactory;
import org.flyte.flytekit.SdkNode;
import org.flyte.flytekit.SdkTypes;
import org.flyte.flytekit.SdkWorkflow;
import org.flyte.flytekit.SdkWorkflowBuilder;
import org.flyte.flytekit.jackson.JacksonSdkType;
@AutoService(SdkWorkflow.class)
public class AllInputsWorkflow
extends SdkWorkflow {
public AllInputsWorkflow() {
super(SdkTypes.nulls(), JacksonSdkType.of(AllInputsWorkflow.AllInputsWorkflowOutput.class));
}
@Override
public AllInputsWorkflowOutput expand(SdkWorkflowBuilder builder, Void noInput) {
Instant someInstant = Instant.parse("2023-01-16T00:00:00Z");
SdkNode apply =
builder.apply(
"all-inputs",
new AllInputsTask(),
AllInputsTask.AutoAllInputsInput.create(
SdkBindingDataFactory.of(1L),
SdkBindingDataFactory.of(2.00),
SdkBindingDataFactory.of("test"),
SdkBindingDataFactory.of(true),
SdkBindingDataFactory.of(someInstant),
SdkBindingDataFactory.of(Duration.ofDays(1L)),
SdkBindingDataFactory.ofStringCollection(Arrays.asList("foo", "bar")),
SdkBindingDataFactory.ofStringMap(Map.of("test", "test")),
SdkBindingDataFactory.ofStringCollection(Collections.emptyList()),
SdkBindingDataFactory.ofIntegerMap(Collections.emptyMap())));
AllInputsTask.AutoAllInputsOutput outputs = apply.getOutputs();
return AllInputsWorkflowOutput.create(
outputs.i(),
outputs.f(),
outputs.s(),
outputs.b(),
outputs.t(),
outputs.d(),
outputs.l(),
outputs.m(),
outputs.emptyList(),
outputs.emptyMap());
}
@AutoValue
public abstract static class AllInputsWorkflowOutput {
public abstract SdkBindingData i();
public abstract SdkBindingData f();
public abstract SdkBindingData s();
public abstract SdkBindingData b();
public abstract SdkBindingData t();
public abstract SdkBindingData d();
// TODO add blobs to sdkbinding data
// public abstract SdkBindingData blob();
public abstract SdkBindingData> l();
public abstract SdkBindingData
© 2015 - 2025 Weber Informatics LLC | Privacy Policy