`dag.roots` returns a list of tasks that don't have downstream task.
There's a bit of a gotcha since you don't want for your "very_last_task" to
be defined at the moment where you build that list or filter it out somehow
since it can't be set as a dependency for itself. Just something to be
aware of.

https://github.com/apache/incubator-airflow/blob/4ec932b551774bb394c5770c4d2660f565a4c592/airflow/models.py#L3071

On Thu, Apr 20, 2017 at 2:14 PM, Ace Haidrey <[email protected]> wrote:

> I’m sorry if this isn’t the right place to ask questions. I just wanted to
> know if there is a good way to know which tasks are leaf nodes in a given
> dag programmatically. I’m looking to automate a certain process for our
> work flow at Pandora and need that information to do so.
>
> Thanks,
> Ace
>

Reply via email to