[jira] [Commented] (AIRFLOW-3361) Add the task_id to the Deprecation Warning when passing unsupported keywords to BaseOperator

2018-11-18 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/AIRFLOW-3361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16691042#comment-16691042
 ] 

ASF GitHub Bot commented on AIRFLOW-3361:
-

ashb closed pull request #4030: [AIRFLOW-3361] Log the task_id in the 
PendingDeprecationWarning for BaseOperator
URL: https://github.com/apache/incubator-airflow/pull/4030
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/models.py b/airflow/models.py
index 239a3a5263..47a1827e09 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -2494,12 +2494,13 @@ def __init__(
 if args or kwargs:
 # TODO remove *args and **kwargs in Airflow 2.0
 warnings.warn(
-'Invalid arguments were passed to {c}. Support for '
-'passing such arguments will be dropped in Airflow 2.0. '
-'Invalid arguments were:'
+'Invalid arguments were passed to {c} (task_id: {t}). '
+'Support for passing such arguments will be dropped in '
+'Airflow 2.0. Invalid arguments were:'
 '\n*args: {a}\n**kwargs: {k}'.format(
-c=self.__class__.__name__, a=args, k=kwargs),
-category=PendingDeprecationWarning
+c=self.__class__.__name__, a=args, k=kwargs, t=task_id),
+category=PendingDeprecationWarning,
+stacklevel=3
 )
 
 validate_key(task_id)
diff --git a/tests/core.py b/tests/core.py
index c37b1f9c8b..5f24b6c1e9 100644
--- a/tests/core.py
+++ b/tests/core.py
@@ -443,7 +443,8 @@ def test_illegal_args(self):
 self.assertTrue(
 issubclass(w[0].category, PendingDeprecationWarning))
 self.assertIn(
-'Invalid arguments were passed to BashOperator.',
+('Invalid arguments were passed to BashOperator '
+ '(task_id: test_illegal_args).'),
 w[0].message.args[0])
 
 def test_bash_operator(self):


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add the task_id to the Deprecation Warning when passing unsupported keywords 
> to BaseOperator
> 
>
> Key: AIRFLOW-3361
> URL: https://issues.apache.org/jira/browse/AIRFLOW-3361
> Project: Apache Airflow
>  Issue Type: Task
>  Components: logging
>Affects Versions: 1.9.0
>Reporter: Martin Black
>Assignee: Martin Black
>Priority: Trivial
> Fix For: 2.0.0, 1.10.2
>
>
> In 2.0 passing invalid keywords to {{BaseOperator}} will be deprecated. Prior 
> to that, there is a {{PendingDeprecationWarning}} raised, however it can be 
> hard to track down which specific task is raising this warning.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AIRFLOW-3361) Add the task_id to the Deprecation Warning when passing unsupported keywords to BaseOperator

2018-11-18 Thread Martin Black (JIRA)


[ 
https://issues.apache.org/jira/browse/AIRFLOW-3361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16690880#comment-16690880
 ] 

Martin Black commented on AIRFLOW-3361:
---

PR https://github.com/apache/incubator-airflow/pull/4030

> Add the task_id to the Deprecation Warning when passing unsupported keywords 
> to BaseOperator
> 
>
> Key: AIRFLOW-3361
> URL: https://issues.apache.org/jira/browse/AIRFLOW-3361
> Project: Apache Airflow
>  Issue Type: Task
>  Components: logging
>Affects Versions: 1.9.0
>Reporter: Martin Black
>Assignee: Martin Black
>Priority: Trivial
>
> In 2.0 passing invalid keywords to {{BaseOperator}} will be deprecated. Prior 
> to that, there is a {{PendingDeprecationWarning}} raised, however it can be 
> hard to track down which specific task is raising this warning. This PR adds 
> the {{task_id}} to aid this.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)