gabrielboehme commented on issue #26760:
URL: https://github.com/apache/airflow/issues/26760#issuecomment-1675096321

   @viniciusdsmello I have encountered the same problem as you. I have the 
following dag which sends a Slack notification. In my case, task_1 throws an 
error, but the given context to the callback function is for task_2.
   
   `def slack_alert(context):
       slack_msg = \
           f"""
               :x: Task Failed.
   ]            *Task*: {context.get('task_instance').task_id}
               *Dag*: {context.get('task_instance').dag_id}
               *Execution Time*: {context.get('execution_date')}
               <{context.get('task_instance').log_url}|*Logs*>
           """
       slk = SlackHelper()
       slk.send_message_to_channel(
           channel="#random_channel",
           text=slack_msg
       )`


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