You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/06/05 09:29:18 UTC

[airflow] branch main updated: AIP-47 - Migrate cassandra DAGs to new design #22439 (#24209)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new eee6bc9691 AIP-47 - Migrate cassandra DAGs to new design #22439 (#24209)
eee6bc9691 is described below

commit eee6bc969138e3f6e8f4dec4fd3d9a0d51f70a4c
Author: chethanuk-plutoflume <ch...@tessian.com>
AuthorDate: Sun Jun 5 10:29:09 2022 +0100

    AIP-47 - Migrate cassandra DAGs to new design #22439 (#24209)
---
 .../providers/apache/cassandra/example_dags/__init__.py  | 16 ----------------
 docs/apache-airflow-providers-apache-cassandra/index.rst |  2 +-
 .../operators.rst                                        |  2 +-
 .../providers/apache/cassandra}/example_cassandra_dag.py | 11 ++++++++++-
 4 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/airflow/providers/apache/cassandra/example_dags/__init__.py b/airflow/providers/apache/cassandra/example_dags/__init__.py
deleted file mode 100644
index 13a83393a9..0000000000
--- a/airflow/providers/apache/cassandra/example_dags/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
diff --git a/docs/apache-airflow-providers-apache-cassandra/index.rst b/docs/apache-airflow-providers-apache-cassandra/index.rst
index 4f207a2e3f..b23fd6351b 100644
--- a/docs/apache-airflow-providers-apache-cassandra/index.rst
+++ b/docs/apache-airflow-providers-apache-cassandra/index.rst
@@ -38,7 +38,7 @@ Content
     :maxdepth: 1
     :caption: Resources
 
-    Example DAGs <https://github.com/apache/airflow/tree/main/airflow/providers/apache/cassandra/example_dags>
+    Example DAGs <https://github.com/apache/airflow/tree/main/tests/system/providers/apache/cassandra>
     PyPI Repository <https://pypi.org/project/apache-airflow-providers-apache-cassandra/>
     Installing from sources <installing-providers-from-sources>
 
diff --git a/docs/apache-airflow-providers-apache-cassandra/operators.rst b/docs/apache-airflow-providers-apache-cassandra/operators.rst
index 3b359eff00..e0a1e10b55 100644
--- a/docs/apache-airflow-providers-apache-cassandra/operators.rst
+++ b/docs/apache-airflow-providers-apache-cassandra/operators.rst
@@ -50,7 +50,7 @@ Use the ``keys`` parameter to poke until the provided record is found. The exist
 Example use of these sensors
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-.. exampleinclude:: /../../airflow/providers/apache/cassandra/example_dags/example_cassandra_dag.py
+.. exampleinclude:: /../../tests/system/providers/apache/cassandra/example_cassandra_dag.py
     :language: python
     :start-after: [START howto_operator_cassandra_sensors]
     :end-before: [END howto_operator_cassandra_sensors]
diff --git a/airflow/providers/apache/cassandra/example_dags/example_cassandra_dag.py b/tests/system/providers/apache/cassandra/example_cassandra_dag.py
similarity index 85%
rename from airflow/providers/apache/cassandra/example_dags/example_cassandra_dag.py
rename to tests/system/providers/apache/cassandra/example_cassandra_dag.py
index bf4067eba0..d68b5fbe03 100644
--- a/airflow/providers/apache/cassandra/example_dags/example_cassandra_dag.py
+++ b/tests/system/providers/apache/cassandra/example_cassandra_dag.py
@@ -23,15 +23,19 @@
 Example Airflow DAG to check if a Cassandra Table and a Records exists
 or not using `CassandraTableSensor` and `CassandraRecordSensor`.
 """
+
+import os
 from datetime import datetime
 
 from airflow.models import DAG
 from airflow.providers.apache.cassandra.sensors.record import CassandraRecordSensor
 from airflow.providers.apache.cassandra.sensors.table import CassandraTableSensor
 
+ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
+DAG_ID = "example_cassandra_operator"
 # [START howto_operator_cassandra_sensors]
 with DAG(
-    dag_id='example_cassandra_operator',
+    dag_id=DAG_ID,
     schedule_interval=None,
     start_date=datetime(2021, 1, 1),
     default_args={'table': 'keyspace_name.table_name'},
@@ -42,3 +46,8 @@ with DAG(
 
     record_sensor = CassandraRecordSensor(task_id="cassandra_record_sensor", keys={"p1": "v1", "p2": "v2"})
 # [END howto_operator_cassandra_sensors]
+
+from tests.system.utils import get_test_run  # noqa: E402
+
+# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest)
+test_run = get_test_run(dag)