airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] ron819 closed pull request #4075: [AIRFLOW-502] BashOperator success/failure conditions not documented
Date Wed, 14 Nov 2018 08:22:36 GMT
ron819 closed pull request #4075: [AIRFLOW-502] BashOperator success/failure conditions not

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/operators/ b/airflow/operators/
index f9c2e1bbc0..1cdf8ed717 100644
--- a/airflow/operators/
+++ b/airflow/operators/
@@ -49,6 +49,16 @@ class BashOperator(BaseOperator):
     :type env: dict
     :param output_encoding: Output encoding of bash command
     :type output_encoding: str
+    On execution of the operator the task will up for retry when exception is raised.
+    However if a sub-command exists with non-zero value Airflow will not recognize
+    it as failure unless the whole shell exits with a failure. The easiest way of 
+    achieving this is to prefix the command with ``set -e;`` 
+    Example:
+        bash_command = "python3 '{{ next_execution_date }}'"
+        when executing command exit(1) the task will be marked as success.
+        bash_command = "set -e; python3 '{{ next_execution_date }}'"
+        when executing command ``exit(1)`` the task will be marked as up for retry.
     template_fields = ('bash_command', 'env')
     template_ext = ('.sh', '.bash',)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message