From 4aebd9ade5dc8232b5911855e36342184b7f4cca Mon Sep 17 00:00:00 2001 From: Chethan UK Date: Thu, 2 Jun 2022 23:29:52 +0100 Subject: [PATCH] Migrate Singularity example DAGs to new design #22464 --- .../singularity/example_dags/__init__.py | 17 ----------------- .../index.rst | 2 +- .../singularity}/example_singularity.py | 12 +++++++++++- 3 files changed, 12 insertions(+), 19 deletions(-) delete mode 100644 airflow/providers/singularity/example_dags/__init__.py rename {airflow/providers/singularity/example_dags => tests/system/providers/singularity}/example_singularity.py (84%) diff --git a/airflow/providers/singularity/example_dags/__init__.py b/airflow/providers/singularity/example_dags/__init__.py deleted file mode 100644 index 217e5db960782..0000000000000 --- a/airflow/providers/singularity/example_dags/__init__.py +++ /dev/null @@ -1,17 +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-singularity/index.rst b/docs/apache-airflow-providers-singularity/index.rst index 32acfebd72098..8f8eb723b0cb3 100644 --- a/docs/apache-airflow-providers-singularity/index.rst +++ b/docs/apache-airflow-providers-singularity/index.rst @@ -32,7 +32,7 @@ Content :maxdepth: 1 :caption: Resources - Example DAGs + Example DAGs PyPI Repository Installing from sources diff --git a/airflow/providers/singularity/example_dags/example_singularity.py b/tests/system/providers/singularity/example_singularity.py similarity index 84% rename from airflow/providers/singularity/example_dags/example_singularity.py rename to tests/system/providers/singularity/example_singularity.py index cf54a28084de0..eff80652bb5d9 100644 --- a/airflow/providers/singularity/example_dags/example_singularity.py +++ b/tests/system/providers/singularity/example_singularity.py @@ -16,14 +16,18 @@ # specific language governing permissions and limitations # under the License. +import os from datetime import datetime, timedelta from airflow import DAG from airflow.operators.bash import BashOperator from airflow.providers.singularity.operators.singularity import SingularityOperator +ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID") +DAG_ID = "singularity_sample" + with DAG( - 'singularity_sample', + DAG_ID, default_args={'retries': 1}, schedule_interval=timedelta(minutes=10), start_date=datetime(2021, 1, 1), @@ -44,3 +48,9 @@ t1 >> [t2, t3] t3 >> t4 + + +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)