You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bo...@apache.org on 2017/04/06 07:47:31 UTC
incubator-airflow git commit: [AIRFLOW-969] Catch bad python_callable
argument
Repository: incubator-airflow
Updated Branches:
refs/heads/v1-8-test dff6d21bf -> 916741171
[AIRFLOW-969] Catch bad python_callable argument
Checks for callable when Operator is
created, not when it is run.
* added initial PythonOperator unit test, testing
run
* python_callable must be callable; added unit
test
Closes #2142 from abloomston/python-callable
(cherry picked from commit 12901ddfa9961a11feaa3f17696d19102ff8ecd0)
Signed-off-by: Bolke de Bruin <bo...@xs4all.nl>
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/91674117
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/91674117
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/91674117
Branch: refs/heads/v1-8-test
Commit: 916741171cc0c6426dbcbe8a2b5ce2468fce870d
Parents: dff6d21
Author: abloomston <ad...@cloverhealth.com>
Authored: Thu Mar 16 19:36:00 2017 -0400
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Thu Apr 6 09:47:18 2017 +0200
----------------------------------------------------------------------
airflow/operators/python_operator.py | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/91674117/airflow/operators/python_operator.py
----------------------------------------------------------------------
diff --git a/airflow/operators/python_operator.py b/airflow/operators/python_operator.py
index 114bc7e..cf240f2 100644
--- a/airflow/operators/python_operator.py
+++ b/airflow/operators/python_operator.py
@@ -16,6 +16,7 @@ from builtins import str
from datetime import datetime
import logging
+from airflow.exceptions import AirflowException
from airflow.models import BaseOperator, TaskInstance
from airflow.utils.state import State
from airflow.utils.decorators import apply_defaults
@@ -63,6 +64,8 @@ class PythonOperator(BaseOperator):
templates_exts=None,
*args, **kwargs):
super(PythonOperator, self).__init__(*args, **kwargs)
+ if not callable(python_callable):
+ raise AirflowException('`python_callable` param must be callable')
self.python_callable = python_callable
self.op_args = op_args or []
self.op_kwargs = op_kwargs or {}