[go: nahoru, domu]

Skip to content

Commit

Permalink
Migrate Opsgenie example DAGs to new design apache#22455
Browse files Browse the repository at this point in the history
  • Loading branch information
chethanuk committed Jun 3, 2022
1 parent f294a26 commit fb51377
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
16 changes: 0 additions & 16 deletions airflow/providers/opsgenie/example_dags/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/apache-airflow-providers-opsgenie/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Content
:maxdepth: 1
:caption: Resources

Example DAGs <https://github.com/apache/airflow/tree/main/airflow/providers/opsgenie/example_dags>
Example DAGs <https://github.com/apache/airflow/tree/main/tests/system/providers/opsgenie>
PyPI Repository <https://pypi.org/project/apache-airflow-providers-opsgenie/>
Installing from sources <installing-providers-from-sources>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Using the Operator
^^^^^^^^^^^^^^^^^^
Send an alert to Opsgenie with a specific message.

.. exampleinclude:: /../../airflow/providers/opsgenie/example_dags/example_opsgenie_alert.py
.. exampleinclude:: /../../tests/system/providers/opsgenie/example_opsgenie_alert.py
:language: python
:start-after: [START howto_opsgenie_create_alert_operator]
:end-before: [END howto_opsgenie_create_alert_operator]
Expand All @@ -44,7 +44,7 @@ Using the Operator
^^^^^^^^^^^^^^^^^^
Close alert in Opsgenie.

.. exampleinclude:: /../../airflow/providers/opsgenie/example_dags/example_opsgenie_alert.py
.. exampleinclude:: /../../tests/system/providers/opsgenie/example_opsgenie_alert.py
:language: python
:start-after: [START howto_opsgenie_close_alert_operator]
:end-before: [END howto_opsgenie_close_alert_operator]
Expand All @@ -61,7 +61,7 @@ Using the Operator
^^^^^^^^^^^^^^^^^^
Delete alert in Opsgenie.

.. exampleinclude:: /../../airflow/providers/opsgenie/example_dags/example_opsgenie_alert.py
.. exampleinclude:: /../../tests/system/providers/opsgenie/example_opsgenie_alert.py
:language: python
:dedent: 4
:start-after: [START howto_opsgenie_delete_alert_operator]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import os
from datetime import datetime

from airflow import DAG
Expand All @@ -23,8 +24,11 @@
OpsgenieDeleteAlertOperator,
)

ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
DAG_ID = "opsgenie_alert_operator_dag"

with DAG(
dag_id="opsgenie_alert_operator_dag",
dag_id=DAG_ID,
schedule_interval=None,
start_date=datetime(2021, 1, 1),
catchup=False,
Expand All @@ -45,3 +49,8 @@
task_id="opsgenie_delete_task", identifier="identifier_example"
)
# [END howto_opsgenie_delete_alert_operator]

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)

0 comments on commit fb51377

Please sign in to comment.