-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add typed transform inputs #175
Conversation
39b162e
to
517f129
Compare
... flytekit-java compiles but tests fails Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Andres Gomez Ferrer <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Andres Gomez Ferrer <[email protected]>
Signed-off-by: Andres Gomez Ferrer <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
flytekit-examples-scala/src/main/scala/org/flyte/examples/flytekitscala/AddQuestionTask.scala
Show resolved
Hide resolved
/** | ||
* Generate an immutable value class that represents {@link AddQuestionTask}'s input, which is a | ||
* String. | ||
*/ | ||
@AutoValue | ||
public abstract static class Input { | ||
public abstract SdkBindingData<String> greeting(); | ||
|
||
public static Input create(SdkBindingData<String> greeting) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewers
Before we were only using the AutoValue to define the type of the task, but now we actually create the auto values to pass it in the apply
import javax.annotation.Nullable; | ||
|
||
public class SdkCondition<OutputT> extends SdkTransform<OutputT> { | ||
public class SdkCondition<OutputT> extends SdkTransform<Void, OutputT> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewers
We made a SdkCondition to have no inputs on itself but the transformations going on when, and otherwise cases could have a combination of both:
- SdkTransforms that takes no inputs
- SdkTransforms that takes inputs but the inputs are supplied
All of them should have the same ouput type
flytekit-java/src/main/java/org/flyte/flytekit/SdkConditions.java
Outdated
Show resolved
Hide resolved
flytekit-java/src/main/java/org/flyte/flytekit/SdkPartialTransform.java
Outdated
Show resolved
Hide resolved
flytekit-java/src/main/java/org/flyte/flytekit/SdkRemoteLaunchPlan.java
Outdated
Show resolved
Hide resolved
flytekit-java/src/main/java/org/flyte/flytekit/SdkRemoteLaunchPlan.java
Outdated
Show resolved
Hide resolved
flytekit-java/src/main/java/org/flyte/flytekit/SdkRemoteLaunchPlan.java
Outdated
Show resolved
Hide resolved
@@ -91,4 +74,16 @@ public SdkTransform<T> withTimeoutOverride(Duration timeout) { | |||
public String getName() { | |||
return getClass().getName(); | |||
} | |||
|
|||
void checkNullOnlyVoid(@Nullable InputT inputs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewers
This method makes sure that the input "nullness" matches the input type:
null
in the only valid value forVoid
andUnit
SdkType
s- Any other
SdkType
cannot havenull
If you have a better name please suggest it
flytekit-java/src/test/java/org/flyte/flytekit/SdkLaunchPlanRegistrarTest.java
Outdated
Show resolved
Hide resolved
flytekit-local-engine/src/test/java/org/flyte/localengine/examples/TestUnaryIntegerOutput.java
Show resolved
Hide resolved
Signed-off-by: Nelson Arapé <[email protected]>
Signed-off-by: Nelson Arapé <[email protected]>
TL;DR
This feature allows the users to know the specific inputs from a task at development time. This is really important when you are working with a remote task that is developed by other users.
Type
Are all requirements met?
Complete description
This feature allows the users to know the specific inputs from a task at development time. This is really important when you are working with a remote task that is developed by other users. The final goal is to use the input class in the WorkflowBuilder instead of passing the input into the SdkTransform using the withInput(...) method that forces you to know the attribute names of the input class. Example: Fibonacci Workflow
Tracking Issue
Follow-up issue
NA