Hi,

I am trying to make airflow mark tasks as failed when an exception is raised. I 
have saved a python script to disk which I would like to run with the 
BashOperator like this:

import sys
def myfunc(a):
    if a == True:
        return
    else:
        raise Exception

if __name__ == '__main__':
    try:
        myfunc(False)
    except:
        sys.exit(1)

When running code like this, I would expect that I would see a red circle 
(indicating failure) in my overview since the except part is excecuted. 
However, I see dark green indicating that the task was a succes. Could anyone 
explain how to make the tasks indicate it when they failed?

Thanks in advance,

Johan de Braak
Data Analyst

[Description: Beschrijving: Description: Description: 
M:\Project_Acquisition\ACQUISITION DOCUMENTS\09. Huisstijl en 
plaatjes\Huisstijl\LOGO ELEAF High Res.jpg]

[email protected]<mailto:[email protected]>
eLEAF Competence Center * www.eleaf.com<http://www.eleaf.com/>
This message is intended for the exclusive use of the person(s) mentioned as 
recipient(s) and may contain personal and/or confidential information. If you 
have received this message in error, please notify the sender and delete this 
message from your system immediately. Directly or indirectly copying, 
disclosing, distributing, printing, publicizing and/or in any way using this 
message or any part thereof by any means is strictly prohibited if you are not 
the intended recipient(s). This message and any associated attachments cannot 
be deemed as legally binding under any circumstances without the express 
written consent from eLEAF(c). eLEAF(c) is not responsible for any loss and/or 
damages arising from any errors and/or omissions in its e-mail messages. 
Reference to the own general terms and conditions by the other party is 
explicitly rejected by eLEAF(c). Please read our general terms and condition on 
http://www.eleaf.com/legal.
P You save 200 ml of water, 2g of CO2 and 2g of wood per page: Please print 
only if it is really necessary.

Reply via email to