eladkal opened a new issue, #29900:
URL: https://github.com/apache/airflow/issues/29900

   ### Body
   
   There are some use cases where users want to trigger new DAG run as soon as 
one finished. This is a request I've seen several times with some variations 
(for example like this [Stackoverflow 
question](https://stackoverflow.com/q/75623153/14624409)) but the basic request 
is the same.
   
   The workaround users do to get such functionality is place 
`TriggerDagRunOperator` as last task of their DAG invoking the same DAG:
   
   ```
   from datetime import datetime
   
   from airflow import DAG
   from airflow.operators.empty import EmptyOperator
   from airflow.operators.trigger_dagrun import TriggerDagRunOperator
   
   with DAG(
       dag_id="example",
       start_date=datetime(2023, 1, 1,),
       catchup=False,
       schedule=None,
   ) as dag:
       task = EmptyOperator(task_id="first")
       trigger = TriggerDagRunOperator(
           task_id="trigger",
           trigger_dag_id="example",
       )
   
       task >> trigger
   
   ```
   
   As you can see this works nicely:
   ![Screenshot 2023-03-03 at 14 20 
51](https://user-images.githubusercontent.com/45845474/222718862-dfde8a41-24b6-4991-b318-b7f9784514f6.png)
   
   My suggestion is to add first class support for this use case, so the above 
example will be changed to:
   
   ```
   
   from datetime import datetime
   
   from airflow import DAG
   from airflow.operators.empty import EmptyOperator
   from airflow.operators.trigger_dagrun import TriggerDagRunOperator
   
   with DAG(
       dag_id="example",
       start_date=datetime(2023, 1, 1,),
       catchup=False,
       schedule="@continues",
   ) as dag:
       task = EmptyOperator(task_id="first")
   ```
   
   I guess it won't exactly be "@continues" but more likely new 
[ScheduleArg](https://github.com/apache/airflow/blob/8b8552f5c4111fe0732067d7af06aa5285498a79/airflow/models/dag.py#L127)
 type but I show it like that just for simplification of the idea.
   
   ### Committer
   
   - [X] I acknowledge that I am a maintainer/committer of the Apache Airflow 
project.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to