You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airflow.apache.org by Ace Haidrey <ah...@pandora.com> on 2017/04/20 21:14:20 UTC

Airflow Leaf Tasks

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

Re: Airflow Leaf Tasks

Posted by Maxime Beauchemin <ma...@gmail.com>.
`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 <ah...@pandora.com> 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
>