Skip to content

Commit

Permalink
Undelete hello_world.py (flyteorg#287)
Browse files Browse the repository at this point in the history
Signed-off-by: Ketan Umare <[email protected]>
  • Loading branch information
kumare3 authored Jun 13, 2021
1 parent d873d89 commit 71d882d
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions cookbook/core/flyte_basics/hello_world.py
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()}")

0 comments on commit 71d882d

Please sign in to comment.