Matthew Revell created AIRFLOW-2099:
---------------------------------------

             Summary: 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


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