forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Undelete hello_world.py (flyteorg#287)
Signed-off-by: Ketan Umare <[email protected]>
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
Hello World Workflow | ||
-------------------- | ||
This simple workflow calls a task that returns "Hello World" and then just sets that as the final output of the workflow. | ||
""" | ||
import typing | ||
|
||
from flytekit import task, workflow | ||
|
||
|
||
# You can change the signature of the workflow to take in an argument like this: | ||
# def say_hello(name: str) -> str: | ||
@task | ||
def say_hello() -> str: | ||
return "hello world" | ||
|
||
|
||
# %% | ||
# You can treat the outputs of a task as you normally would a Python function. Assign the output to two variables | ||
# and use them in subsequent tasks as normal. See :py:func:`flytekit.workflow` | ||
# You can change the signature of the workflow to take in an argument like this: | ||
# def my_wf(name: str) -> str: | ||
@workflow | ||
def my_wf() -> str: | ||
res = say_hello() | ||
return res | ||
|
||
|
||
# %% | ||
# Execute the Workflow, simply by invoking it like a function and passing in | ||
# the necessary parameters | ||
# | ||
# .. note:: | ||
# | ||
# One thing to remember, currently we only support ``Keyword arguments``. So | ||
# every argument should be passed in the form ``arg=value``. Failure to do so | ||
# will result in an error | ||
if __name__ == "__main__": | ||
print(f"Running my_wf() {my_wf()}") |