-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hongxin Liang <[email protected]>
- Loading branch information
Showing
15 changed files
with
417 additions
and
39 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...mples-scala/src/main/resources/META-INF/services/org.flyte.flytekit.SdkLaunchPlanRegistry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
org.flyte.examples.flytekitscala.FibonacciLaunchPlan | ||
org.flyte.examples.flytekitscala.LaunchPlanRegistry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
flytekit-examples-scala/src/main/resources/META-INF/services/org.flyte.flytekit.SdkWorkflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
org.flyte.examples.flytekitscala.FibonacciWorkflow | ||
org.flyte.examples.flytekitscala.WelcomeWorkflow | ||
org.flyte.examples.flytekitscala.NestedIOWorkflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
flytekit-examples-scala/src/main/scala/org/flyte/examples/flytekitscala/NestedIOTask.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright 2023 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.flytekitscala | ||
|
||
import org.flyte.flytekit.{SdkBindingData, SdkRunnableTask, SdkTransform} | ||
import org.flyte.flytekitscala.{ | ||
Description, | ||
SdkBindingDataFactory, | ||
SdkScalaType | ||
} | ||
|
||
case class NestedNestedNested(string: String) | ||
case class NestedNested(double: Double, nested: NestedNestedNested) | ||
case class Nested( | ||
boolean: Boolean, | ||
byte: Byte, | ||
short: Short, | ||
int: Int, | ||
long: Long, | ||
float: Float, | ||
double: Double, | ||
string: String, | ||
list: List[String], | ||
map: Map[String, String], | ||
optBoolean: Option[Boolean], | ||
optByte: Option[Byte], | ||
optList: Option[List[String]], | ||
optMap: Option[Map[String, String]], | ||
nested: NestedNested | ||
) | ||
case class NestedIOTaskInput( | ||
@Description("the name of the person to be greeted") | ||
name: SdkBindingData[String], | ||
@Description("a nested input") | ||
generic: SdkBindingData[Nested] | ||
) | ||
case class NestedIOTaskOutput( | ||
@Description("the name of the person to be greeted") | ||
name: SdkBindingData[String], | ||
@Description("a nested input") | ||
generic: SdkBindingData[Nested] | ||
) | ||
|
||
/** Example Flyte task that takes a name as the input and outputs a simple | ||
* greeting message. | ||
*/ | ||
class NestedIOTask | ||
extends SdkRunnableTask[ | ||
NestedIOTaskInput, | ||
NestedIOTaskOutput | ||
]( | ||
SdkScalaType[NestedIOTaskInput], | ||
SdkScalaType[NestedIOTaskOutput] | ||
) { | ||
|
||
/** Defines task behavior. This task takes a name as the input, wraps it in a | ||
* welcome message, and outputs the message. | ||
* | ||
* @param input | ||
* the name of the person to be greeted | ||
* @return | ||
* the welcome message | ||
*/ | ||
override def run(input: NestedIOTaskInput): NestedIOTaskOutput = | ||
NestedIOTaskOutput( | ||
input.name, | ||
input.generic | ||
) | ||
} |
37 changes: 37 additions & 0 deletions
37
...kit-examples-scala/src/main/scala/org/flyte/examples/flytekitscala/NestedIOWorkflow.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2020-2023 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.flytekitscala | ||
|
||
import org.flyte.flytekitscala.{ | ||
SdkScalaType, | ||
SdkScalaWorkflow, | ||
SdkScalaWorkflowBuilder | ||
} | ||
|
||
class NestedIOWorkflow | ||
extends SdkScalaWorkflow[NestedIOTaskInput, Unit]( | ||
SdkScalaType[NestedIOTaskInput], | ||
SdkScalaType.unit | ||
) { | ||
|
||
override def expand( | ||
builder: SdkScalaWorkflowBuilder, | ||
input: NestedIOTaskInput | ||
): Unit = { | ||
builder.apply(new NestedIOTask(), input) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.