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

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -