tanelk commented on issue #22078:
URL: https://github.com/apache/airflow/issues/22078#issuecomment-1067649663


   With this change
   
   ```diff --git a/airflow/sensors/external_task.py 
b/airflow/sensors/external_task.py
   index b0ffed69b..0aafb7541 100644
   --- a/airflow/sensors/external_task.py
   +++ b/airflow/sensors/external_task.py
   @@ -42,7 +42,18 @@ class ExternalTaskSensorLink(BaseOperatorLink):
        def get_link(self, operator, dttm):
            ti = TaskInstance(task=operator, execution_date=dttm)
            operator.render_template_fields(ti.get_template_context())
   -        query = {"dag_id": operator.external_dag_id, "execution_date": 
dttm.isoformat()}
   +
   +        if operator.execution_delta:
   +            execution_date = dttm - operator.execution_delta
   +        elif operator.execution_date_fn:
   +            execution_date = 
operator._handle_execution_date_fn(context=ti.get_template_context())
   +        else:
   +            execution_date = dttm
   +
   +        query = {
   +            "dag_id": operator.external_dag_id,
   +            "execution_date": execution_date.isoformat()
   +        }
            return build_airflow_url_with_query(query)
   ```
   
   I get this exception when opening the task instance pop-up in the UI:
   ```
   [2022-03-15 07:10:14,468] {app.py:1892} ERROR - Exception on /extra_links 
[GET]
   Traceback (most recent call last):
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in 
wsgi_app
       response = self.full_dispatch_request()
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in 
full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in 
handle_user_exception
       reraise(exc_type, exc_value, tb)
     File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, 
in reraise
       raise value
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in 
dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File "/opt/airflow/airflow/www/auth.py", line 51, in decorated
       return func(*args, **kwargs)
     File "/opt/airflow/airflow/www/decorators.py", line 80, in wrapper
       return f(*args, **kwargs)
     File "/opt/airflow/airflow/utils/session.py", line 71, in wrapper
       return func(*args, session=session, **kwargs)
     File "/opt/airflow/airflow/www/views.py", line 3241, in extra_links
       url = task.get_extra_links(ti, link_name)
     File "/opt/airflow/airflow/models/abstractoperator.py", line 268, in 
get_extra_links
       return link.get_link(self, ti.dag_run.logical_date)  # type: ignore[misc]
     File "/opt/airflow/airflow/sensors/external_task.py", line 46, in get_link
       if operator.execution_delta:
   AttributeError: 'SerializedBaseOperator' object has no attribute 
'execution_delta'
   ```


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