airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Can you have a DAG dependent on another DAG?

Open dirkgently007 opened this issue 11 years ago • 5 comments

I see airflow.operators.ExternalTaskSensor supports dependency on an ask in another DAG. But is it possible to set dependency on another DAG itself? In other words, can external_task_id parameter be optional?

dirkgently007 avatar Jun 05 '15 19:06 dirkgently007

Not for now but it'd be easy to either write an ExternalDagSensor, or add a DummyOperator to the DAG you want to depend on that would be downstream of all the tasks, and use the ExternalTaskSensor against it.

mistercrunch avatar Jun 05 '15 22:06 mistercrunch

Thanks @mistercrunch . I think DummyOperator should be an easy solution.

Should I close this?

dirkgently007 avatar Jun 11 '15 14:06 dirkgently007

Yup, closing.

mistercrunch avatar Jun 11 '15 20:06 mistercrunch

@mistercrunch sorry to hijack this thread but I've been using the DummyOperator approach for a couple Dags and was considering writing an ExternalDagSensor. Would you accept a PR for one? My thought was it would be identical to ExternalTaskSensor except instead of looking at just one task it would look at every task in the DAG (which it would retrieve from the ORM).

jlowin avatar Sep 29 '15 16:09 jlowin

@jlowin , ExternalDagSensor sounds good, check out the DAG's root property to get all tasks without downstream deps.

I like for everything in a DAG to converge to a last point (an email operator + slack operator that post about completion) but I can understand that not everyone build their DAGs that way.

mistercrunch avatar Oct 01 '15 05:10 mistercrunch