Skip to content

Instantly share code, notes, and snippets.

@MatrixManAtYrService
Last active May 12, 2021 23:06
Show Gist options
  • Save MatrixManAtYrService/389f0fe345c8749587600ed6ba8adc24 to your computer and use it in GitHub Desktop.
Save MatrixManAtYrService/389f0fe345c8749587600ed6ba8adc24 to your computer and use it in GitHub Desktop.
@task
def print_one(it):
print(it)
@task
def print_another(it):
print(it)
@task
def return_two() -> Tuple[str, int]
return "nine", 6
@dag
def the_dag():
# a, b == "nine", 6
a, b = return_two()
# dag structure is inferred
print_one(a)
print_another(b)
d = the_dag()
@task
def return_two() -> Dict[str, str]:
return {"one": "nine", "another": 6}
@dag
def the_dag():
# a is a dict
a = return_two()
# outputs must be referenced stringly
b = print_one("{{ ti.xcom_pull(key='one') }}")
c = print_another("{{ ti.xcom_pull(key='another') }}")
# dag structure is explicit
a >> b
a >> c
d = the_dag()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment