0

I want to run python script in airflow. To achieve the same I am triggering script using airflow bash operator like below.

sub_dag = BashOperator(
task_id='execute_dependent_dag',
bash_command='python myscript.py',
dag=dag,
trigger_rule="all_success")

However I want it to be triggered asynchronously. Currently it is waiting for script to get finish. I used & as well as nohup to make it run but it didn't work.

Let me know if there is any other way to run it asynchronously. Thanks in advance.

1 Answer 1

1
  • I believe extending BashOperator to remove wait() call would make that happen with the downside that errors would go silently undetected

  • Alternatively if the python script / code in question can be imported into your Airflow project, you could try doing the same with PythonOperator through multiprocessing (or a variety of other ways)

Also if you want to get your hands dirty, have a look at this

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.