Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



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")




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: