kaxil commented on issue #51563:
URL: https://github.com/apache/airflow/issues/51563#issuecomment-2960010078

   Depending on what you want to do, you can also use Task Context:
   
   
   
   ```python
   from airflow.sdk import dag, get_current_context, task
   from airflow.utils.state import DagRunState
   from datetime import datetime
   
   @dag(dag_id = "test_airflow3",
        start_date = datetime(2025, 1, 1),
        schedule = "@hourly",
        tags = ["misc"],
        catchup = False)
   def mon_dag():
   
       @task(task_id = "appel_dagrun_find")
       def ma_premiere_tache():
           context = get_current_context()
           ti = context["ti"]
           dag_run = context["dag_run"]        
   
       ma_premiere_tache()
   
   mon_dag()
   ```
   
   and then other options:
   
   
https://github.com/apache/airflow/blob/bf0bfe9dc1f3812989acfe6ed7118acf9ba5b586/task-sdk/src/airflow/sdk/types.py#L100-L118


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