From 1ed0f8cd34117eaa6fdf67dee616e7ab2ce5b25a Mon Sep 17 00:00:00 2001
From: Idris Adebisi <idris.adebisi@yahoo.com>
Date: Thu, 14 Nov 2024 11:49:08 +0000
Subject: [PATCH 1/7] Moved trigger_dagrun operator to standard provider

---
 .../src/airflow/providers/standard}/operators/trigger_dagrun.py   | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename {airflow => providers/src/airflow/providers/standard}/operators/trigger_dagrun.py (100%)

diff --git a/airflow/operators/trigger_dagrun.py b/providers/src/airflow/providers/standard/operators/trigger_dagrun.py
similarity index 100%
rename from airflow/operators/trigger_dagrun.py
rename to providers/src/airflow/providers/standard/operators/trigger_dagrun.py

From 4d2df5b4258a2a3497e527912b2fc049e72f3c45 Mon Sep 17 00:00:00 2001
From: Idris Adebisi <idris.adebisi@yahoo.com>
Date: Thu, 14 Nov 2024 11:57:05 +0000
Subject: [PATCH 2/7] Changed all imports for dagrun_operator from operators to
 standard provider.

---
 airflow/example_dags/example_trigger_controller_dag.py       | 2 +-
 airflow/serialization/serialized_objects.py                  | 2 +-
 tests/operators/test_trigger_dagrun.py                       | 2 +-
 tests/serialization/test_dag_serialization.py                | 2 +-
 tests/system/core/example_external_task_parent_deferrable.py | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/airflow/example_dags/example_trigger_controller_dag.py b/airflow/example_dags/example_trigger_controller_dag.py
index e68e60c4b19a3..e546bd0a7e87d 100644
--- a/airflow/example_dags/example_trigger_controller_dag.py
+++ b/airflow/example_dags/example_trigger_controller_dag.py
@@ -26,7 +26,7 @@
 import pendulum
 
 from airflow.models.dag import DAG
-from airflow.operators.trigger_dagrun import TriggerDagRunOperator
+from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunOperator
 
 with DAG(
     dag_id="example_trigger_controller_dag",
diff --git a/airflow/serialization/serialized_objects.py b/airflow/serialization/serialized_objects.py
index 12adf6a7f50f4..516d1927697e3 100644
--- a/airflow/serialization/serialized_objects.py
+++ b/airflow/serialization/serialized_objects.py
@@ -1020,7 +1020,7 @@ class DependencyDetector:
     @staticmethod
     def detect_task_dependencies(task: Operator) -> list[DagDependency]:
         """Detect dependencies caused by tasks."""
-        from airflow.operators.trigger_dagrun import TriggerDagRunOperator
+        from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunOperator
         from airflow.sensors.external_task import ExternalTaskSensor
 
         deps = []
diff --git a/tests/operators/test_trigger_dagrun.py b/tests/operators/test_trigger_dagrun.py
index ec714110eb8f2..cfd925c24b94e 100644
--- a/tests/operators/test_trigger_dagrun.py
+++ b/tests/operators/test_trigger_dagrun.py
@@ -30,7 +30,7 @@
 from airflow.models.dagrun import DagRun
 from airflow.models.log import Log
 from airflow.models.taskinstance import TaskInstance
-from airflow.operators.trigger_dagrun import TriggerDagRunOperator
+from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunOperator
 from airflow.settings import TracebackSessionForTests
 from airflow.triggers.external_task import DagStateTrigger
 from airflow.utils import timezone
diff --git a/tests/serialization/test_dag_serialization.py b/tests/serialization/test_dag_serialization.py
index d10984556ff23..ae6595881636b 100644
--- a/tests/serialization/test_dag_serialization.py
+++ b/tests/serialization/test_dag_serialization.py
@@ -1805,7 +1805,7 @@ def test_derived_dag_deps_operator(self):
         Tests DAG dependency detection for operators, including derived classes
         """
         from airflow.operators.empty import EmptyOperator
-        from airflow.operators.trigger_dagrun import TriggerDagRunOperator
+        from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunOperator
 
         class DerivedOperator(TriggerDagRunOperator):
             pass
diff --git a/tests/system/core/example_external_task_parent_deferrable.py b/tests/system/core/example_external_task_parent_deferrable.py
index 62bb1afc18b2e..860cec5d0896f 100644
--- a/tests/system/core/example_external_task_parent_deferrable.py
+++ b/tests/system/core/example_external_task_parent_deferrable.py
@@ -18,7 +18,7 @@
 
 from airflow import DAG
 from airflow.operators.empty import EmptyOperator
-from airflow.operators.trigger_dagrun import TriggerDagRunOperator
+from airflow.providers.standard.operators.trigger_dagrun import TriggerDagRunOperator
 from airflow.sensors.external_task import ExternalTaskSensor
 from airflow.utils.timezone import datetime
 

From 3a0eba6fa58e60b2a58f5fea423389b2efbda9c3 Mon Sep 17 00:00:00 2001
From: Idris Adebisi <idris.adebisi@yahoo.com>
Date: Thu, 14 Nov 2024 12:50:03 +0000
Subject: [PATCH 3/7] Changed all imports for dagrun_operator from operators to
 standard provider.

---
 airflow/serialization/serialized_objects.py | 2 +-
 tests/operators/test_trigger_dagrun.py      | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/airflow/serialization/serialized_objects.py b/airflow/serialization/serialized_objects.py
index 516d1927697e3..8db48676c94cb 100644
--- a/airflow/serialization/serialized_objects.py
+++ b/airflow/serialization/serialized_objects.py
@@ -119,7 +119,7 @@
 log = logging.getLogger(__name__)
 
 _OPERATOR_EXTRA_LINKS: set[str] = {
-    "airflow.operators.trigger_dagrun.TriggerDagRunLink",
+    "airflow.providers.standard.operators.trigger_dagrun.TriggerDagRunLink",
     "airflow.sensors.external_task.ExternalDagLink",
     # Deprecated names, so that existing serialized dags load straight away.
     "airflow.sensors.external_task.ExternalTaskSensorLink",
diff --git a/tests/operators/test_trigger_dagrun.py b/tests/operators/test_trigger_dagrun.py
index cfd925c24b94e..ad1fca15ea46d 100644
--- a/tests/operators/test_trigger_dagrun.py
+++ b/tests/operators/test_trigger_dagrun.py
@@ -107,7 +107,9 @@ def assert_extra_link(self, triggered_dag_run, triggering_task, session):
             )
             .one()
         )
-        with mock.patch("airflow.operators.trigger_dagrun.build_airflow_url_with_query") as mock_build_url:
+        with mock.patch(
+            "airflow.providers.standard.operators.trigger_dagrun.build_airflow_url_with_query"
+        ) as mock_build_url:
             triggering_task.get_extra_links(triggering_ti, "Triggered DAG")
         assert mock_build_url.called
         args, _ = mock_build_url.call_args

From 284277173b74ebb22e2fc62221a30da74457f876 Mon Sep 17 00:00:00 2001
From: Idris Adebisi <idris.adebisi@yahoo.com>
Date: Thu, 14 Nov 2024 14:30:56 +0000
Subject: [PATCH 4/7] Update trigger_dagrun doc reference

---
 docs/apache-airflow/core-concepts/dags.rst      | 2 +-
 docs/apache-airflow/operators-and-hooks-ref.rst | 2 +-
 newsfragments/41736.significant.rst             | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/docs/apache-airflow/core-concepts/dags.rst b/docs/apache-airflow/core-concepts/dags.rst
index ae4da4ab18c68..98823fbc85ad7 100644
--- a/docs/apache-airflow/core-concepts/dags.rst
+++ b/docs/apache-airflow/core-concepts/dags.rst
@@ -765,7 +765,7 @@ While dependencies between tasks in a DAG are explicitly defined through upstrea
 relationships, dependencies between DAGs are a bit more complex. In general, there are two ways
 in which one DAG can depend on another:
 
-- triggering - :class:`~airflow.operators.trigger_dagrun.TriggerDagRunOperator`
+- triggering - :class:`~airflow.providers.standard.operators.trigger_dagrun.TriggerDagRunOperator`
 - waiting - :class:`~airflow.sensors.external_task_sensor.ExternalTaskSensor`
 
 Additional difficulty is that one DAG could wait for or trigger several runs of the other DAG
diff --git a/docs/apache-airflow/operators-and-hooks-ref.rst b/docs/apache-airflow/operators-and-hooks-ref.rst
index ae131fb8d268f..22a320fb7bb64 100644
--- a/docs/apache-airflow/operators-and-hooks-ref.rst
+++ b/docs/apache-airflow/operators-and-hooks-ref.rst
@@ -65,7 +65,7 @@ For details see: :doc:`apache-airflow-providers:operators-and-hooks-ref/index`.
    * - :mod:`airflow.operators.latest_only`
      -
 
-   * - :mod:`airflow.operators.trigger_dagrun`
+   * - :mod:`airflow.providers.standard.operators.trigger_dagrun`
      -
 
 **Sensors:**
diff --git a/newsfragments/41736.significant.rst b/newsfragments/41736.significant.rst
index 2c90979d80f06..92ab8cb92a8ff 100644
--- a/newsfragments/41736.significant.rst
+++ b/newsfragments/41736.significant.rst
@@ -3,5 +3,5 @@ Removed deprecated parameters from core-operators.
 Parameters removed:
 
 - airflow.operators.datetime.BranchDateTimeOperator: use_task_execution_date
-- airflow.operators.trigger_dagrun.TriggerDagRunOperator: execution_date
+- airflow.providers.standard.operators.trigger_dagrun.TriggerDagRunOperator: execution_date
 - airflow.operators.weekday.BranchDayOfWeekOperator: use_task_execution_day

From e26249f07ad02477e94501ec4428ec4560b9f296 Mon Sep 17 00:00:00 2001
From: Idris Adebisi <idris.adebisi@yahoo.com>
Date: Sat, 16 Nov 2024 10:26:40 +0000
Subject: [PATCH 5/7] Revert Changes

---
 newsfragments/41736.significant.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newsfragments/41736.significant.rst b/newsfragments/41736.significant.rst
index 92ab8cb92a8ff..2c90979d80f06 100644
--- a/newsfragments/41736.significant.rst
+++ b/newsfragments/41736.significant.rst
@@ -3,5 +3,5 @@ Removed deprecated parameters from core-operators.
 Parameters removed:
 
 - airflow.operators.datetime.BranchDateTimeOperator: use_task_execution_date
-- airflow.providers.standard.operators.trigger_dagrun.TriggerDagRunOperator: execution_date
+- airflow.operators.trigger_dagrun.TriggerDagRunOperator: execution_date
 - airflow.operators.weekday.BranchDayOfWeekOperator: use_task_execution_day

From 2eff9b069b423d6d1ba893b00702894d07fe0b29 Mon Sep 17 00:00:00 2001
From: Idris Adebisi <idris.adebisi@yahoo.com>
Date: Sat, 16 Nov 2024 12:42:52 +0000
Subject: [PATCH 6/7] Add trigger_dagrun to standard provider.yaml file.

---
 providers/src/airflow/providers/standard/provider.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/providers/src/airflow/providers/standard/provider.yaml b/providers/src/airflow/providers/standard/provider.yaml
index ba1a53e44bf8e..4c051d5334417 100644
--- a/providers/src/airflow/providers/standard/provider.yaml
+++ b/providers/src/airflow/providers/standard/provider.yaml
@@ -48,6 +48,7 @@ operators:
       - airflow.providers.standard.operators.bash
       - airflow.providers.standard.operators.python
       - airflow.providers.standard.operators.generic_transfer
+      - airflow.providers.standard.operators.trigger_dagrun
 
 sensors:
   - integration-name: Standard

From c5f77d6ca02df97b5c7ed84d7beeca9d96b2c2b9 Mon Sep 17 00:00:00 2001
From: Idris Adebisi <idris.adebisi@yahoo.com>
Date: Sat, 16 Nov 2024 17:42:51 +0000
Subject: [PATCH 7/7] Change BaseOperator[Link] import path.

---
 .../src/airflow/providers/standard/operators/trigger_dagrun.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/providers/src/airflow/providers/standard/operators/trigger_dagrun.py b/providers/src/airflow/providers/standard/operators/trigger_dagrun.py
index e65a74ef2b9a7..3081892391232 100644
--- a/providers/src/airflow/providers/standard/operators/trigger_dagrun.py
+++ b/providers/src/airflow/providers/standard/operators/trigger_dagrun.py
@@ -34,8 +34,7 @@
     DagNotFound,
     DagRunAlreadyExists,
 )
-from airflow.models.baseoperator import BaseOperator
-from airflow.models.baseoperatorlink import BaseOperatorLink
+from airflow.models import BaseOperator, BaseOperatorLink
 from airflow.models.dag import DagModel
 from airflow.models.dagbag import DagBag
 from airflow.models.dagrun import DagRun
