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

 ##########
 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:
   OK, I'll add those exceptions to `AthenaOperator`. Thx.

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