XD-DENG commented on a change in pull request #4919: [AIRFLOW-4093] Add 
exception if job failed or cancelled or retry too many times
URL: https://github.com/apache/airflow/pull/4919#discussion_r265861986
 
 

 ##########
 File path: airflow/contrib/hooks/aws_athena_hook.py
 ##########
 @@ -127,14 +127,21 @@ def poll_query_status(self, query_execution_id, 
max_tries=None):
             elif query_state in self.INTERMEDIATE_STATES:
                 self.log.info('Trial {try_number}: Query is still in an 
intermediate state - {state}'
                               .format(try_number=try_number, 
state=query_state))
+            elif query_state in self.FAILURE_STATES:
+                self.log.error('Trial {try_number}: Query is failed - {state}'
+                               .format(try_number=try_number, 
state=query_state))
+                raise Exception('Athena job 
{state}.'.format(state=query_state))
             else:
                 self.log.info('Trial {try_number}: Query execution completed. 
Final state is {state}'
                               .format(try_number=try_number, 
state=query_state))
                 final_query_state = query_state
                 break
 
 Review comment:
   IMO `poll_query_status` is doing its job nicely (return the final state. As 
long as it's "final", no matter success or failed). I don't see issue in it.
   
   It should be `poll_query_status`'s downstream's responsibility to behave 
according to the result from `poll_query_status`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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