ron819 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_r229667702
 
 

 ##########
 File path: airflow/operators/bash_operator.py
 ##########
 @@ -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 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.
 
 Review comment:
   @ashb The exit(1) is common for scripting. There are many work-around to 
make it "airflow" however people needs to know to make such modification. This 
problem occurs as I expected airflow to catch the unsuccessful exit but it 
didn't. This PR only adds instructions for thous who will encounter a situation 
like me. Are we discussing the necessity of such notice in the docs or the 
words of the notice itself?
   
   This problem is hard to catch as if the user run the script from bash he 
would see it fails but if run from airflow he won't see the failure. In order 
to make changes with the code as you suggest the user must know that he 
requires to. My PR is attempt to alert the user about the issue.. there can be 
other (maybe better) way.. I'm open to suggestions.

----------------------------------------------------------------
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