Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions providers/amazon/docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
Changelog
---------

.. note::
The ``db_cluster_id`` argument of ``NeptuneStartDbClusterOperator`` and
``NeptuneStopDbClusterOperator`` is renamed to ``cluster_id`` so that it matches the
operators' templated ``cluster_id`` attribute. Update Dags that pass ``db_cluster_id=``
to use ``cluster_id=`` instead.

9.34.0
......

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class NeptuneStartDbClusterOperator(AwsBaseOperator[NeptuneHook]):
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:NeptuneStartDbClusterOperator`

:param db_cluster_id: The DB cluster identifier of the Neptune DB cluster to be started.
:param cluster_id: The DB cluster identifier of the Neptune DB cluster to be started.
:param wait_for_completion: Whether to wait for the cluster to start. (default: True)
:param deferrable: If True, the operator will wait asynchronously for the cluster to start.
This implies waiting for completion. This mode requires aiobotocore module to be installed.
Expand All @@ -117,15 +117,15 @@ class NeptuneStartDbClusterOperator(AwsBaseOperator[NeptuneHook]):

def __init__(
self,
db_cluster_id: str,
cluster_id: str,
wait_for_completion: bool = True,
waiter_delay: int = 30,
waiter_max_attempts: int = 60,
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
**kwargs,
):
super().__init__(**kwargs)
self.cluster_id = db_cluster_id
self.cluster_id = cluster_id
self.wait_for_completion = wait_for_completion
self.deferrable = deferrable
self.waiter_delay = waiter_delay
Expand Down Expand Up @@ -211,7 +211,7 @@ class NeptuneStopDbClusterOperator(AwsBaseOperator[NeptuneHook]):
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:NeptuneStartDbClusterOperator`

:param db_cluster_id: The DB cluster identifier of the Neptune DB cluster to be stopped.
:param cluster_id: The DB cluster identifier of the Neptune DB cluster to be stopped.
:param wait_for_completion: Whether to wait for cluster to stop. (default: True)
:param deferrable: If True, the operator will wait asynchronously for the cluster to stop.
This implies waiting for completion. This mode requires aiobotocore module to be installed.
Expand All @@ -234,15 +234,15 @@ class NeptuneStopDbClusterOperator(AwsBaseOperator[NeptuneHook]):

def __init__(
self,
db_cluster_id: str,
cluster_id: str,
wait_for_completion: bool = True,
waiter_delay: int = 30,
waiter_max_attempts: int = 60,
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
**kwargs,
):
super().__init__(**kwargs)
self.cluster_id = db_cluster_id
self.cluster_id = cluster_id
self.wait_for_completion = wait_for_completion
self.deferrable = deferrable
self.waiter_delay = waiter_delay
Expand Down
4 changes: 2 additions & 2 deletions providers/amazon/tests/system/amazon/aws/example_neptune.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def delete_cluster(cluster_id):
cluster_id = f"{env_id}-cluster"

# [START howto_operator_start_neptune_cluster]
start_cluster = NeptuneStartDbClusterOperator(task_id="start_task", db_cluster_id=cluster_id)
start_cluster = NeptuneStartDbClusterOperator(task_id="start_task", cluster_id=cluster_id)
# [END howto_operator_start_neptune_cluster]

# [START howto_operator_stop_neptune_cluster]
stop_cluster = NeptuneStopDbClusterOperator(task_id="stop_task", db_cluster_id=cluster_id)
stop_cluster = NeptuneStopDbClusterOperator(task_id="stop_task", cluster_id=cluster_id)
# [END howto_operator_stop_neptune_cluster]

chain(
Expand Down
38 changes: 19 additions & 19 deletions providers/amazon/tests/unit/amazon/aws/operators/test_neptune.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TestNeptuneStartClusterOperator:
def test_start_cluster_wait_for_completion(self, mock_hook_get_waiter, mock_conn):
operator = NeptuneStartDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=True,
aws_conn_id="aws_default",
Expand All @@ -75,7 +75,7 @@ def test_start_cluster_wait_for_completion(self, mock_hook_get_waiter, mock_conn
def test_start_cluster_no_wait(self, mock_hook_get_waiter, mock_conn):
operator = NeptuneStartDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -92,7 +92,7 @@ def test_start_cluster_cluster_available(self, mock_waiter, mock_get_cluster_sta
mock_get_cluster_status.return_value = "available"
operator = NeptuneStartDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=True,
aws_conn_id="aws_default",
Expand All @@ -108,7 +108,7 @@ def test_start_cluster_cluster_available(self, mock_waiter, mock_get_cluster_sta
def test_start_cluster_deferrable(self, mock_conn):
operator = NeptuneStartDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=True,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -124,7 +124,7 @@ def test_start_cluster_cluster_error(self, mock_waiter, mock_get_cluster_status,
mock_get_cluster_status.return_value = "migration-failed"
operator = NeptuneStartDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=True,
aws_conn_id="aws_default",
Expand All @@ -145,7 +145,7 @@ def test_start_cluster_not_ready_defer(self, mock_conn, mock_wait, mock_defer):
mock_conn.start_db_cluster.side_effect = exception
operator = NeptuneStartDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=True,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -171,7 +171,7 @@ def test_start_cluster_instances_not_ready(self, mock_conn, mock_get_waiter):

operator = NeptuneStartDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -192,7 +192,7 @@ def test_start_cluster_instances_not_ready_defer(self, mock_conn, mock_defer):
mock_conn.start_db_cluster.side_effect = exception
operator = NeptuneStartDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=True,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -206,7 +206,7 @@ def test_start_cluster_instances_not_ready_defer(self, mock_conn, mock_defer):
def test_template_fields(self):
operator = NeptuneStartDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=True,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -223,7 +223,7 @@ def test_stop_cluster_wait_for_completion(self, mock_hook_get_waiter, mock_get_c
mock_get_cluster_status.return_value = "available"
operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=True,
aws_conn_id="aws_default",
Expand All @@ -241,7 +241,7 @@ def test_stop_cluster_no_wait(self, mock_hook_get_waiter, mock_get_cluster_statu

operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -258,7 +258,7 @@ def test_stop_cluster_cluster_stopped(self, mock_waiter, mock_get_cluster_status
mock_get_cluster_status.return_value = "stopped"
operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=True,
aws_conn_id="aws_default",
Expand All @@ -277,7 +277,7 @@ def test_stop_cluster_cluster_error(self, mock_waiter, mock_get_cluster_status,
mock_get_cluster_status.return_value = "migration-failed"
operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=True,
aws_conn_id="aws_default",
Expand All @@ -293,7 +293,7 @@ def test_stop_cluster_not_in_available(self, mock_waiter, mock_get_cluster_statu
mock_get_cluster_status.return_value = "backing-up"
operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=True,
aws_conn_id="aws_default",
Expand All @@ -313,7 +313,7 @@ def test_stop_cluster_not_ready_defer(self, mock_conn, mock_defer):
mock_conn.stop_db_cluster.side_effect = exception
operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=True,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -335,7 +335,7 @@ def test_stop_cluster_instances_not_ready(self, mock_get_waiter, mock_get_cluste

operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=False,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -356,7 +356,7 @@ def test_stop_cluster_instances_not_ready_defer(self, mock_conn, mock_defer):
mock_conn.stop_db_cluster.side_effect = exception
operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=True,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -372,7 +372,7 @@ def test_stop_cluster_instances_not_ready_defer(self, mock_conn, mock_defer):
def test_stop_cluster_deferrable(self, mock_conn):
operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=True,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand All @@ -384,7 +384,7 @@ def test_stop_cluster_deferrable(self, mock_conn):
def test_template_fields(self):
operator = NeptuneStopDbClusterOperator(
task_id="task_test",
db_cluster_id=CLUSTER_ID,
cluster_id=CLUSTER_ID,
deferrable=True,
wait_for_completion=False,
aws_conn_id="aws_default",
Expand Down
2 changes: 0 additions & 2 deletions scripts/ci/prek/validate_operators_init_exemptions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#
# Fixing a class MUST remove its entry in the same PR — the hook fails on stale entries.
# Burn-down tracked at https://github.com/apache/airflow/issues/70296
providers/amazon/src/airflow/providers/amazon/aws/operators/neptune.py::NeptuneStartDbClusterOperator
providers/amazon/src/airflow/providers/amazon/aws/operators/neptune.py::NeptuneStopDbClusterOperator
providers/amazon/src/airflow/providers/amazon/aws/transfers/gcs_to_s3.py::GCSToS3Operator
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py::KubernetesPodOperator
providers/google/src/airflow/providers/google/cloud/operators/cloud_batch.py::CloudBatchSubmitJobOperator
Expand Down