airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlo...@apache.org
Subject incubator-airflow git commit: AIRFLOW-52 Warn about overwriting tasks in a DAG
Date Mon, 09 May 2016 22:53:57 GMT
Repository: incubator-airflow
Updated Branches:
  refs/heads/master 61f35782f -> 385add2bf


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/385add2b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/385add2b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/385add2b

Branch: refs/heads/master
Commit: 385add2bf3eb7cd6103cfec0e5516234eeb72443
Parents: 61f3578
Author: jlowin <jlowin@users.noreply.github.com>
Authored: Mon May 9 18:53:24 2016 -0400
Committer: jlowin <jlowin@users.noreply.github.com>
Committed: Mon May 9 18:53:24 2016 -0400

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


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/385add2b/airflow/models.py
----------------------------------------------------------------------
diff --git a/airflow/models.py b/airflow/models.py
index a40d2d4..f47d1a6 100644
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -2979,9 +2979,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