airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davy...@apache.org
Subject [3/5] incubator-airflow git commit: AIRFLOW-52 Warn about overwriting tasks in a DAG
Date Mon, 09 May 2016 23:52:38 GMT
AIRFLOW-52 Warn about overwriting tasks in a DAG


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/ff3a8552
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/ff3a8552
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/ff3a8552

Branch: refs/heads/airbnb_rb1.7.1_3
Commit: ff3a8552501ac88821f3ce641471cd396ca93d6b
Parents: 0e5fb90
Author: jlowin <jlowin@users.noreply.github.com>
Authored: Mon May 9 18:53:24 2016 -0400
Committer: Dan Davydov <dan.davydov@airbnb.com>
Committed: Mon May 9 16:13:00 2016 -0700

----------------------------------------------------------------------
 airflow/models.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/ff3a8552/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index dda9bb9..c3a01b0 100644
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -2937,9 +2937,13 @@ class DAG(LoggingMixin):
             task.start_date = self.start_date
 
         if task.task_id in self.task_dict:
-            raise AirflowException(
-                "Task id '{0}' has already been added "
-                "to the DAG ".format(task.task_id))
+            #TODO raise an error in Airflow 2.0
+            warnings.warn(
+                'The requested task could not be added to the DAG because a '
+                'task with task_id {} is already in the DAG. Starting in '
+                'Airflow 2.0, trying to overwrite a task will raise an '
+                'exception.'.format(task.task_id),
+                category=PendingDeprecationWarning)
         else:
             self.tasks.append(task)
             self.task_dict[task.task_id] = task


Mime
View raw message