ephraimbuddy commented on issue #56204:
URL: https://github.com/apache/airflow/issues/56204#issuecomment-3557016884

   Easiest way is to update the code so that the TriggerDagRunOperator is run 
as a task:
   
   ```python
   with DAG(
       dag_id="Task-Run-Demo",
       schedule="0 0 * * *",  # Daily at midnight (00:00)
       catchup=False,
       params={"schedule_date": Param(f"{datetime.date.today()}", 
type="string", format="date")},
   ) as dag:
   
       @task
       def schedule_dags(**kwargs):
           return {"status": "ready"}
       trigger_tasks = []
       for i in range(5):
           execution_date = utcnow() + datetime.timedelta(minutes=5)
           trigger_tasks.append(
               TriggerDagRunOperator(
                   task_id=f"create_reports_dag_{i}",
                   trigger_dag_id="Create-Reports",
                   conf={"counter": i},
                   logical_date=execution_date.replace(tzinfo=pytz.UTC),
               )
           )
   
       schedule_dags() >> trigger_tasks
   
   with DAG(
       dag_id="Create-Reports",
       schedule=None,
       catchup=False,
       params={"counter": None},
   ) as target_dag:
   
       @task.python
       def report(params: dict):
           
           counter = params["counter"]
           logging.info(f"Current counter: {counter}")
   
           return {"counter": counter, "status": "processed"}
   
       report()
   ```
   
   Let me know what you think about this approach and we can update the doc 
about it. @hussein-awala @mweisshaupt1988 
   
   Another option is to use `SUPERVISOR_COMMS` which I do not recommend (and 
not sure if it's made for public use)


-- 
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