Include_tasks docs lack info on tail recursion

We’ll need to answer a few fundamental questions before we can get this documented. Here’s my short list:

  1. Question for the Steering Committee: Is this an intended feature that will be carried into the future, or is this merely a side effect of the way import_tasks include_tasks is implemented which could disappear in a future release?

  2. Does this work for any other flavors of include_* or import_*? If so, the scope of the question just got a bit creepier. (See what I did there? :slight_smile:

  3. What circumstances prevent tail recursion? I’ve found by trial and error that having a vars: on the last task in the included task files’ last step is one such breaker. [Edit: The error I incurred, “… maximum recursion depth exceeded”, was due to a variable defined in terms of itself, not that the final include_tasks step had a vars: section.] What else?

Other questions? Maybe someone who knows how it’s implemented would have additional insights…

Tail recursion is an “in-the-weeds” topic anyway. How do we provide enough technical detail to cover it while not overwhelming the include_tasks doc? Should it be split between the include_tasks doc and the tips-n-tricks page, or all in one place? Should an example be added the to async: doc (since async job queue management is a practical example of its application)?

3 Likes