zlacker

[parent] [thread] 1 comments
1. Too+(OP)[view] [source] 2023-05-13 06:39:55
From that link

    print_the_cat_fact(get_a_cat_fact())
Doesn’t seem like a big pain?

Looks like that page overcomplicate it by describing every underlying layer and old history of it.

replies(1): >>rubenf+Y2
2. rubenf+Y2[view] [source] 2023-05-13 07:22:31
>>Too+(OP)
That's because you're looking at the TaskFlow syntax and a trivial example of passing all the results from a Task A as all the inputs of a Task B that follows it immediately. TaskFlow works mostly in trivial case. The true syntax for it is in the tab "Traditional syntax". For a complex graph where you're passing data from step A to a node that is far down the tree and deeply nested and you will see that it's quite cumbersome. Even in their trivial example:

    res = requests.get(url)
    ti.xcom_push(key="cat_fact", value=json.loads(res.text)["fact"])

    ...
  
    cat_fact = ti.xcom_pull(key="cat_fact", task_ids="get_a_cat_fact")
[go to top]