python - Airflow: how to force fail bash operator -


i running series of python scripts (ex: script1.py, script2.py) in script (ex: do_stuff.sh) running using airflow bashoperator. wondering if there way fail bashoperator within python script if specific condition not met? not need script fail per bashoperator can trigger clean_up task.

script1.py:

def main(x)     if x == 0:         raise valueerror('bashoperator fails')     else:         print x if __name__ == '__main__':     import plac     plac.call(main) 

sorry if question basic, still newbie @ airflow/scripting.

thank help!

in bash command should able do:

exit 123 

in case exiting error code 123, use whatever error code want.

edit:

inside python, throwing exception way saying fail task:

raise valueerror('this exit bash error.') 

Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

c# - Populating Gridview inside Listview ItemTemplate On Web User Control from Code Behind -