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

ASF subversion and git services commented on AIRFLOW-2099:
----------------------------------------------------------

Commit a4b9aa386c93d8894a41e986da91d3841bb37f43 in incubator-airflow's branch 
refs/heads/master from Matt Revell
[ https://gitbox.apache.org/repos/asf?p=incubator-airflow.git;h=a4b9aa3 ]

[AIRFLOW-2099] Handle getsource() calls gracefully

There are several scenarios where Task Instance view tries to render
Python callables where 'x' is not the correct artefact to target.

This commit adds a helper fuction to test for known scenarios, and
derives the source from the correc artefact or as a default returns 'No
source available for <type>'. This means that even in unknown or
unfixable edge cases, the Task Instance view still renders instead of
displaying an exception.

Closes #3571 from night0wl/AIRFLOW-2099_task_view_type_check


> Task details cannot be shown when PythonOperator calls partial function / 
> class instance with __call__
> ------------------------------------------------------------------------------------------------------
>
>                 Key: AIRFLOW-2099
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2099
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: ui
>    Affects Versions: Airflow 1.8
>            Reporter: Matthew Revell
>            Assignee: Matthew Revell
>            Priority: Minor
>
> There are several scenarios where the inspect.getsource() method fails with:
> {{object at 0x00000000> is not a module, class, method, function, traceback, 
> frame, or code object}}
> One such scenario is described in 
> [AIRFLOW-1027|https://issues.apache.org/jira/browse/AIRFLOW-1027] where a 
> partial function is used. Another is when an instance of a class which 
> implements __call__() is used.
> Example:
> {{class MyClass(object):}}
> {{    def __init__(self):}}
> {{        pass}}
> {{    def __call__(self):}}
> {{        pass}}
> {{my_class = MyClass()}}
> {{dag_task = PythonOperator(}}
> {{    task_id='dag_task',}}
> {{    dag=dag, }}
> {{    python_callable=my_class,}}
> {{)}}
> There exists a PR for AIRFLOW-1027, however, this fix does not address this 
> other scenario, and also does not guard against any other edge cases which my 
> result in this error in future.
> A better solution would be to catch known scenarios with work arounds, and 
> default to reporting that the source is unavailable for unknown cases. This 
> would at least display the Task Instance details in every case.



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

Reply via email to