-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use a new pair of mixin classes to hold the functions that are compatible with Pydantic V1 and V2, meaning we no longer need to maintain two sets of classes for each Pydantic version * "RunnerIO" classes to be renamed to `Input` and `Output`, keeping the old name as an alias for one release so we can announce the change This PR splits out parts of commits from #1059 that only refactored RunnerIO --------- Signed-off-by: Elliot Gunton <[email protected]>
- Loading branch information
1 parent
b841f6c
commit 345e687
Showing
31 changed files
with
393 additions
and
325 deletions.
There are no files selected for viewing
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
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
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
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
12 changes: 6 additions & 6 deletions
12
examples/workflows/experimental/new_decorators_basic_script.py
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,27 +1,27 @@ | ||
from hera.shared import global_config | ||
from hera.workflows import RunnerInput, RunnerOutput, WorkflowTemplate | ||
from hera.workflows import Input, Output, WorkflowTemplate | ||
|
||
global_config.experimental_features["script_annotations"] = True | ||
global_config.experimental_features["script_pydantic_io"] = True | ||
|
||
w = WorkflowTemplate(name="my-template") | ||
|
||
|
||
class MyInput(RunnerInput): | ||
class MyInput(Input): | ||
user: str | ||
|
||
|
||
@w.script() | ||
def hello_world(my_input: MyInput) -> RunnerOutput: | ||
output = RunnerOutput() | ||
def hello_world(my_input: MyInput) -> Output: | ||
output = Output() | ||
output.result = f"Hello Hera User: {my_input.user}!" | ||
return output | ||
|
||
|
||
# Pass script kwargs (including an alternative public template name) in the decorator | ||
@w.set_entrypoint | ||
@w.script(name="goodbye-world", labels={"my-label": "my-value"}) | ||
def goodbye(my_input: MyInput) -> RunnerOutput: | ||
output = RunnerOutput() | ||
def goodbye(my_input: MyInput) -> Output: | ||
output = Output() | ||
output.result = f"Goodbye Hera User: {my_input.user}!" | ||
return output |
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
File renamed without changes.
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
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
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.