vincbeck commented on PR #28900:
URL: https://github.com/apache/airflow/pull/28900#issuecomment-1620631548

   Some static checks are failing and I think I'll need some help to resolve 
them. I actually understand why they are failing but what I dont understand is 
how come they are not failing in main.
   
   ```
   airflow/models/taskinstance.py:389: error: Item "MappedOperator" of
   "Union[BaseOperator, MappedOperator]" has no attribute "execute"  
[union-attr]
               execute_callable = task_to_execute.execute
                                  ^~~~~~~~~~~~~~~~~~~~~~~
   ```
   `task_to_execute` is defined 
[here](https://github.com/apache/airflow/blob/main/airflow/models/taskinstance.py#L1697).
 Its type is `Operator` which is `Union[BaseOperator, MappedOperator]` 
(definition 
[here](https://github.com/apache/airflow/blob/main/airflow/models/operator.py#L27)).
 It is complaining that `MappedOperator` has no attribute/function `execute`. I 
dont understand how it is not failing today because I have not modified this 
behavior, I must miss something. Do you have any idea?
   
   ```
   airflow/models/taskinstance.py:409: error: Item "MappedOperator" of
   "Union[BaseOperator, MappedOperator]" has no attribute "on_kill"  
[union-attr]
                   task_to_execute.on_kill()
                   ^~~~~~~~~~~~~~~~~~~~~~~
   ```
   Same issue as the one before
   
   ```
   airflow/models/taskinstance.py:414: error: Item "MappedOperator" of
   "Union[BaseOperator, MappedOperator]" has no attribute "do_xcom_push"
   [union-attr]
               if task_to_execute.do_xcom_push:
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ```
   Same issue as the one before
   
   ```
   airflow/www/views.py:1544: error: Item "None" of "Optional[TaskInstance]" has
   no attribute "get_rendered_k8s_spec"  [union-attr]
                   pod_spec = ti.get_rendered_k8s_spec(session=session)
                              ^~~~~~~~~~~~~~~~~~~~~~~~
   ```
   The task instance fetched 
[here](https://github.com/apache/airflow/blob/main/airflow/www/views.py#L1540) 
with the method `dag_run.get_task_instance` returns a type of `TI | None` (see 
definition 
[here](https://github.com/apache/airflow/blob/main/airflow/models/dagrun.py#L500)).
 It si complaining that `ti` can be `None` 
[here](https://github.com/apache/airflow/blob/main/airflow/www/views.py#L1544). 
Same here, I have not modified this piece of code, I dont understand how it is 
passing today. Any idea?
   
   Thanks for your help :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to