Adrian Partl created AIRFLOW-1027:
-------------------------------------
Summary: Task details cannot be shown when PythonOperator calls a
partial function
Key: AIRFLOW-1027
URL: https://issues.apache.org/jira/browse/AIRFLOW-1027
Project: Apache Airflow
Issue Type: Bug
Components: ui
Affects Versions: Airflow 1.7.1
Reporter: Adrian Partl
Assignee: Adrian Partl
Priority: Minor
Showing task details of a PythonOperator that uses a `functools.partial` as a
callable results in the following error:
{noformat}
File "/usr/lib/python2.7/site-packages/airflow/www/views.py", line 909, in
task
special_attrs_rendered[attr_name] = attr_renderer[attr_name](source)
File "/usr/lib/python2.7/site-packages/airflow/www/views.py", line 224, in
<lambda>
inspect.getsource(x), lexers.PythonLexer),
File "/usr/lib64/python2.7/inspect.py", line 701, in getsource
lines, lnum = getsourcelines(object)
File "/usr/lib64/python2.7/inspect.py", line 690, in getsourcelines
lines, lnum = findsource(object)
File "/usr/lib64/python2.7/inspect.py", line 526, in findsource
file = getfile(object)
File "/usr/lib64/python2.7/inspect.py", line 420, in getfile
'function, traceback, frame, or code object'.format(object))
TypeError: <functools.partial object at 0x5ca4d08> is not a module, class,
method, function, traceback, frame, or code object
{noformat}
A sample dag definition for this is:
{noformat}
def func_with_two_args(arg_1, arg_2):
pass
partial_func = functools.partial(func_with_two_args, arg_1=1)
dag = DAG(dag_id='test_issue_1333_dag', default_args=default_args)
dag_task1 = PythonOperator(
task_id='test_dagrun_functool_partial',
dag=dag,
python_callable=partial_func)
{noformat}
I will provide a PR with a fix for this.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)