molcay commented on PR #37087:
URL: https://github.com/apache/airflow/pull/37087#issuecomment-1916616603

   Hi @uranusjr,
   
   I think the use case is a bit different from the datasets. Let's have an 
following DAG as an example;
   ```python3
   import random
   
   from airflow import models
   from airflow.operators.empty import EmptyOperator
   from airflow.operators.python import BranchPythonOperator
   from airflow.operators.trigger_dagrun import TriggerDagRunOperator
   
   import pendulum
   
   
   def check_for_file():
       i = random.randint(1, 8)
       if i % 2 == 1:
           return "do_nothing"
       else:
           return "trigger_dag_again"
   
   
   with models.DAG(dag_id="Trigger_dag_test",
                   start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
                   schedule_interval="*/3 * * * *",
                   catchup=False,
                   tags=['TriggerDagRunOperator']) as dag:
       first_task = EmptyOperator(
           task_id="first_task"
       )
   
       checkforfile = BranchPythonOperator(task_id='check_for_file', 
python_callable=check_for_file)
   
       trigger_dag_again = TriggerDagRunOperator(
           task_id="trigger_dag_again",
           trigger_dag_id="Trigger_dag_test",
           wait_for_completion=False
       )
   
       do_nothing = EmptyOperator(
           task_id="do_nothing"
       )
       final = EmptyOperator(
           task_id="final"
       )
   
   first_task >> checkforfile >> [trigger_dag_again, do_nothing] >> final
   ```
   
   For this DAG, every time the DAG run in scheduled fashion and select the 
trigger_dag_again path, than we see `manual__<date>` as `run_id`, to 
distinguish this programmatically triggered DAG runs (using 
`TriggerDagRunOperator`) we need to introduce a new run type.


-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to