You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/07/22 20:34:47 UTC

[GitHub] [airflow] ManiBharataraju opened a new issue #17176: TriggerDagRunOperator triggering subdags out of order

ManiBharataraju opened a new issue #17176:
URL: https://github.com/apache/airflow/issues/17176


   <!--
   
   Welcome to Apache Airflow!  For a smooth issue process, try to answer the following questions.
   Don't worry if they're not all applicable; just try to include what you can :-)
   
   If you need to include code snippets or logs, please put them in fenced code
   blocks.  If they're super-long, please use the details tag like
   <details><summary>super-long log</summary> lots of stuff </details>
   
   Please delete these comment blocks before submitting the issue.
   
   -->
   
   <!--
   
   IMPORTANT!!!
   
   PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE
   NEXT TO "SUBMIT NEW ISSUE" BUTTON!!!
   
   PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!
   
   Please complete the next sections or the issue will be closed.
   These questions are the first thing we need to know to understand the context.
   
   -->
   
   **Apache Airflow version**: 2.1.1
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   
   **Environment**:
   
   - **Cloud provider or hardware configuration**:
   - **OS** (e.g. from /etc/os-release):
   - **Kernel** (e.g. `uname -a`):
   - **Install tools**:
   - **Others**:
   
   **What happened**:
   We have dags that get triggered by another dag using the TriggerDagRunOperator. These dags include subdags as well. What we are seeing is that it triggers the subdags as well(without checking the dependencies) which should not be the case.
   
   
   
   **What you expected to happen**:
   I would expect the dag run to be created for the parent dag only. The subdags should be run only when the upstream task dependencies are met.
   
   <!-- What do you think went wrong? -->
   
   
   **How to reproduce it**:
   
   Create a dag that includes subdags with upstream task dependencies. Trigger them from another dag and see dag runs created for both subdags and main dag.
   
   <!---
   
   As minimally and precisely as possible. Keep in mind we do not have access to your cluster or dags.
   
   If you are using kubernetes, please attempt to recreate the issue using minikube or kind.
   
   ## Install minikube/kind
   
   - Minikube https://minikube.sigs.k8s.io/docs/start/
   - Kind https://kind.sigs.k8s.io/docs/user/quick-start/
   
   If this is a UI bug, please provide a screenshot of the bug or a link to a youtube video of the bug in action
   
   You can include images using the .md style of
   ![alt text](http://url/to/img.png)
   
   To record a screencast, mac users can use QuickTime and then create an unlisted youtube video with the resulting .mov file.
   
   --->
   
   
   **Anything else we need to know**:
   Its because of this piece of code  I believe
   [https://github.com/apache/airflow/blob/main/airflow/api/common/experimental/trigger_dag.py#L81](url)
   
   which adds the subdags as well to the dags to be triggered. Any reason why this was done?
   
   <!--
   
   How often does this problem occur? Once? Every time etc?
   
   Any relevant logs to include? Put them here in side a detail tag:
   <details><summary>x.log</summary> lots of stuff </details>
   
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ManiBharataraju edited a comment on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
ManiBharataraju edited a comment on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890847471


   @uranusjr - Hey, the line highlighted here, 
   https://github.com/apache/airflow/blob/main/airflow/api/common/experimental/trigger_dag.py#L81
   I removed `dag.subdags` and it looks like below now
   `dags_to_trigger = [dag] `
   But, I am not sure whether that is the right fix for this because it seems to be not a recent change and not sure why it was put in the first place(maybe to support some other use case).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ManiBharataraju edited a comment on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
ManiBharataraju edited a comment on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890295058


   @enriqueayala - We created a custom TriggerDagRunOperator along with the changes in trigger_dag.py. I just copied the trigger dag run operator code and trigger_dag.py code and made the one change that I have mentioned. That worked. 
   But I am unsure of why that was done or if that is the real reason behind this issue. As a temporary fix, u can do that.
   
   With subdags having too many issues, we are planning to use taskgroups instead as a long term fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ManiBharataraju commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
ManiBharataraju commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890847471


   @uranusjr - Hey, the line highlighted here, 
   https://github.com/apache/airflow/blob/main/airflow/api/common/experimental/trigger_dag.py#L81
   I removed `dag.subdags`. But, I am not sure whether that is the right fix for this because it seems to be not a recent change and not sure why it was put in the first place(maybe to support some other use case).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-896572264


   AIP-39 has not been released yet, so unless you’re running Airflow from the `main` branch, it’s not possible any of it would cause this.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ManiBharataraju commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
ManiBharataraju commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-885566541


   Another thing that we are seeing is that subdags are no more created with a backfill run id. They are either scheduled or manual based on their parent dag. Could that be the cause of this issue to popup? Because it worked as expected in 1.10.x version.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ManiBharataraju commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
ManiBharataraju commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890959250


   @uranusjr - 
   
   > Would this not make subdags not triggered at all?
   
   The subdags are getting triggered after upstream dependencies are met. But, without the change, the subdags get triggered as soon as the parent dag is triggered and not respecting the upstream task dependencies. 
   
   One thing that I observed is, the triggered dags no more have run id as `trig__<date>` they now have run id as `manual__<date>` and subdags are inheriting run id from the parent. Previously, the subdag run id used to be `backfill__<date>`. I strongly suspect this change could be the root cause.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] enriqueayala commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
enriqueayala commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890271010


   We're having same issue on 2.1.0 with same use case: TriggerDagRunOperator -> DAG with a subdag . This is affecting subdag tasks relying on xcom values from a parent dag task (which produces incorrect/failed process cause xcom value doesn't exist yet) .  Is there any workaround?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890802484


   @ManiBharataraju WOuld you mind submitting that change you alluded to? (You said you made a change and where you changed, but didn’t mention *what* you changed it into.) We can maybe discuss the issue better when there’s concrete code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ManiBharataraju commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
ManiBharataraju commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-892441714


   Hey @uranusjr - I see AIP-39 where changes are made as to how dags are scheduled now. Do u think that could have caused this? Still trying to understand what has been done in that. I'll let you know if I find anything. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] uranusjr commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890853802


   Yeah that indeed look suspicious. Would this not make subdags *not* triggered at all? 🤔 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ManiBharataraju commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
ManiBharataraju commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890295058


   @enriqueayala - We created a custom TriggerDagRunOperator along with the changes in trigger_dag.py. I just copied the trigger dag run operator code and trigger_dag.py code and made the one change that I have mentioned. That worked. 
   But I am unsure of why that was done or if that is the real reason behind this issue. As a temporary fix, u can do that.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ManiBharataraju edited a comment on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
ManiBharataraju edited a comment on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890295058


   @enriqueayala - We created a custom TriggerDagRunOperator along with the changes in trigger_dag.py. I just copied the trigger dag run operator code and trigger_dag.py code and made the one change that I have mentioned. That worked. 
   But I am unsure of why that was done or if that is the real reason behind this issue. As a temporary fix, u can do that.
   
   With subdags having too many issues, we are planning to use taskgroups as a long-term fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] enriqueayala commented on issue #17176: TriggerDagRunOperator triggering subdags out of order

Posted by GitBox <gi...@apache.org>.
enriqueayala commented on issue #17176:
URL: https://github.com/apache/airflow/issues/17176#issuecomment-890542544


   Thanks @ManiBharataraju 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org