title: Airflow Error callback "on_failure_callback" is not executing all the lines in the function
body: <p>I have a problem in the usage of the on_failure_callback. I have defined my error callback function to perform 2 &quot;http post&quot; requests and I have added a logging.error( ) message between the two. I notice that only one is getting executed. Is there any delay or some thing that I am missing here?
  please help.</p>
  <pre><code>def custom_failure_function(context):
          logging.error(&quot;These task instances ahhh&quot;)
          to_json= json.loads(t_teams)
          var1= json.dumps(to_json)
          print(var1)
          r = requests.post('https://myteamschannel/teams', data=var1,verify=False)
          logging.error(&quot;hello&quot;)
          runID='OPERATION_CONTEXT .OCV8.TEST2 alarm_object 193'
          headers = {'Content-Type':'text/xml'}
          alarmRequest='&lt;soapenv:Envelope xmlns:soapenv=\&quot;http://schemas.xmlsoap.org/soap/envelope/\&quot; xmlns:oper=\&quot;http://172.19.146.147:7180/TeMIP_WS/services/OPERATION_CONTEXT-alarm_object\&quot;&gt;&lt;soapenv:Header xmlns:wsa=\&quot;http://www.w3.org/2005/08/addressing\&quot;&gt;&lt;wsu:Timestamp xmlns:wsu=\&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\&quot;&gt;&lt;wsu:Created&gt;2014-05-22T11:57:38.267Z&lt;/wsu:Created&gt;&lt;wsu:Expires&gt;2014-05-22T12:02:38.000Z&lt;/wsu:Expires&gt;&lt;/wsu:Timestamp&gt;&lt;wsse:Security xmlns:wsse=\&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\&quot; soapenv:mustUnderstand=\&quot;1\&quot;&gt;&lt;wsse:UsernameToken xmlns:wsu=\&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\&quot;&gt;&lt;wsse:Username&gt;girws&lt;/wsse:Username&gt;&lt;wsse:Password Type=\&quot;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\&quot;&gt;Temip&lt;/wsse:Password&gt;&lt;/wsse:UsernameToken&gt;&lt;/wsse:Security&gt;&lt;/soapenv:Header&gt; &lt;soapenv:Body&gt; &lt;oper:Set_Request xmlns:oper=\&quot;http://172.19.146.147:7180/TeMIP_WS/services/OPERATION_CONTEXT-alarm_object\&quot;&gt;&lt;EntitySpec&gt;&lt;Natural&gt; '+ runID +  '&lt;/Natural&gt;&lt;/EntitySpec&gt;&lt;Arguments&gt; &lt;Attribute_Values&gt;&lt;Filtering_Type&gt;' + 'AUTOFAIL' + '&lt;/Filtering_Type&gt;&lt;/Attribute_Values&gt;&lt;/Arguments&gt;&lt;/oper:Set_Request&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt;'
          r = requests.post('http://myerrorappli:7180/TeMIP_WS/services/OPERATION_CONTEXT-alarm_object', header=headers, data=alarmRequest,verify=True)
          logging.error (&quot;FAILED TASK&quot;)
          logging.error(&quot;============================================&quot;) 
  </code></pre>
  <p>The logs of my airflow are below. Its stopping at the &quot;hello&quot; message and not printing &quot;FAILED TASK&quot;.</p>
  <pre><code>*** Reading local file: /data/airflow//logs/MOE_TEST_DAG/TeamsTest/2021-10-02T08:24:14.821970+00:00/3.log
  
  [2021-10-02 10:24:36,535] {MOE_TEST.py:132} ERROR - These task instances ahhh
  [2021-10-02 10:24:36,987] {MOE_TEST.py:138} ERROR - hello
  </code></pre>