ashb commented on a change in pull request #4075: [AIRFLOW-502] BashOperator 
success/failure conditions not documented
URL: https://github.com/apache/incubator-airflow/pull/4075#discussion_r231123082
 
 

 ##########
 File path: airflow/operators/bash_operator.py
 ##########
 @@ -49,6 +49,15 @@ 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 command exists with non-zero value Airflow will not recognize
+    it as failure unless explicitly specified in the beggining of the script.
+    Example:
+        bash_command = "python3 script.py '{{ next_execution_date }}'"
+        when executing command exit(1) the task will be marked as success.
+        bash_command = "set -e; python3 script.py '{{ next_execution_date }}'"
+        when executing command  exit(1) the task will be marked as up for 
retry.
 
 Review comment:
   Also this so that exit(1) is rendered as code/mono-spaced
   ```suggestion
           when executing command ``exit(1)`` the task will be marked as up for 
retry.
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to