Skip to content

Commit

Permalink
Merge pull request #1196 from jlowin/subdag_class
Browse files Browse the repository at this point in the history
Handle both SubDagOperator classes
  • Loading branch information
jlowin committed Apr 1, 2016
2 parents 3198756 + 7398dda commit 154dec0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions airflow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2275,11 +2275,13 @@ def subdags(self):
"""
Returns a list of the subdag objects associated to this DAG
"""
# Late import to prevent circular imports
from airflow.operators import SubDagOperator
# Check SubDag for class but don't check class directly, see
# https://github.com/airbnb/airflow/issues/1168
l = []
for task in self.tasks:
if isinstance(task, SubDagOperator):
if (
task.__class__.__name__ == 'SubDagOperator' and
hasattr(task, 'subdag')):
l.append(task.subdag)
l += task.subdag.subdags
return l
Expand Down

0 comments on commit 154dec0

Please sign in to comment.