You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/01/29 18:45:52 UTC
[airflow] branch master updated: Bugfix: Allow getting details of a
DAG with null start_date (REST API) (#13959)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new fdb83c7 Bugfix: Allow getting details of a DAG with null start_date (REST API) (#13959)
fdb83c7 is described below
commit fdb83c743932b4d1c27a6d16d9a152545e26bf61
Author: Ephraim Anierobi <sp...@gmail.com>
AuthorDate: Fri Jan 29 19:45:41 2021 +0100
Bugfix: Allow getting details of a DAG with null start_date (REST API) (#13959)
---
airflow/api_connexion/openapi/v1.yaml | 1 +
tests/api_connexion/endpoints/test_dag_endpoint.py | 41 +++++++++++++++++++++-
2 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/airflow/api_connexion/openapi/v1.yaml b/airflow/api_connexion/openapi/v1.yaml
index a87a893..6aa4683 100644
--- a/airflow/api_connexion/openapi/v1.yaml
+++ b/airflow/api_connexion/openapi/v1.yaml
@@ -1937,6 +1937,7 @@ components:
type: string
format: 'date-time'
readOnly: true
+ nullable: true
dag_run_timeout:
nullable: true
$ref: '#/components/schemas/TimeDelta'
diff --git a/tests/api_connexion/endpoints/test_dag_endpoint.py b/tests/api_connexion/endpoints/test_dag_endpoint.py
index 0a4b843..146720c 100644
--- a/tests/api_connexion/endpoints/test_dag_endpoint.py
+++ b/tests/api_connexion/endpoints/test_dag_endpoint.py
@@ -42,6 +42,7 @@ class TestDagEndpoint(unittest.TestCase):
dag_id = "test_dag"
task_id = "op1"
dag2_id = "test_dag2"
+ dag3_id = "test_dag3"
@staticmethod
def clean_db():
@@ -80,10 +81,16 @@ class TestDagEndpoint(unittest.TestCase):
with DAG(cls.dag2_id, start_date=datetime(2020, 6, 15)) as dag2: # no doc_md
DummyOperator(task_id=cls.task_id)
+ with DAG(cls.dag3_id) as dag3: # DAG start_date set to None
+ DummyOperator(task_id=cls.task_id, start_date=datetime(2019, 6, 12))
+
cls.dag = dag # type:ignore
cls.dag2 = dag2 # type: ignore
+ cls.dag3 = dag3 # tupe: ignore
+
dag_bag = DagBag(os.devnull, include_examples=False)
- dag_bag.dags = {dag.dag_id: dag, dag2.dag_id: dag2}
+ dag_bag.dags = {dag.dag_id: dag, dag2.dag_id: dag2, dag3.dag_id: dag3}
+
cls.app.dag_bag = dag_bag # type:ignore
@classmethod
@@ -251,6 +258,38 @@ class TestGetDagDetails(TestDagEndpoint):
}
assert response.json == expected
+ def test_should_response_200_for_null_start_date(self):
+ response = self.client.get(
+ f"/api/v1/dags/{self.dag3_id}/details", environ_overrides={'REMOTE_USER': "test"}
+ )
+ assert response.status_code == 200
+ expected = {
+ "catchup": True,
+ "concurrency": 16,
+ "dag_id": "test_dag3",
+ "dag_run_timeout": None,
+ "default_view": "tree",
+ "description": None,
+ "doc_md": None,
+ "fileloc": __file__,
+ "file_token": FILE_TOKEN,
+ "is_paused": None,
+ "is_subdag": False,
+ "orientation": "LR",
+ "owners": [],
+ "params": {},
+ "schedule_interval": {
+ "__type": "TimeDelta",
+ "days": 1,
+ "microseconds": 0,
+ "seconds": 0,
+ },
+ "start_date": None,
+ "tags": None,
+ "timezone": "Timezone('UTC')",
+ }
+ assert response.json == expected
+
def test_should_respond_200_serialized(self):
# Create empty app with empty dagbag to check if DAG is read from db
with conf_vars({("api", "auth_backend"): "tests.test_utils.remote_user_api_auth_backend"}):