ferruzzi commented on code in PR #41407:
URL: https://github.com/apache/airflow/pull/41407#discussion_r1717444787
##########
airflow/providers/amazon/aws/sensors/batch.py:
##########
@@ -87,17 +87,9 @@ def poke(self, context: Context) -> bool:
return False
if state == BatchClientHook.FAILURE_STATE:
- # TODO: remove this if block when min_airflow_version is set to
higher than 2.7.1
- message = f"Batch sensor failed. AWS Batch job status: {state}"
- if self.soft_fail:
- raise AirflowSkipException(message)
- raise AirflowException(message)
-
- # TODO: remove this if block when min_airflow_version is set to higher
than 2.7.1
- message = f"Batch sensor failed. Unknown AWS Batch job status: {state}"
- if self.soft_fail:
- raise AirflowSkipException(message)
- raise AirflowException(message)
+ raise AirflowException(f"Batch sensor failed. AWS Batch job
status: {state}")
+
+ raise AirflowException(f"Batch sensor failed. Unknown AWS Batch job
status: {state}")
Review Comment:
Just to prove I actually reviewed it :P Feel free to reject.
```suggestion
raise AirflowException(f"Batch sensor failed. {"Unknown " if state !=
BatchClientHook.FAILURE_STATE else ""} AWS Batch job status: {state}")
##########
tests/providers/amazon/aws/sensors/test_athena.py:
##########
@@ -73,17 +73,10 @@ def test_poke_intermediate_states(self, state,
mock_poll_query_status):
mock_poll_query_status.side_effect = [state]
assert self.sensor.poke({}) is False
Review Comment:
This is so nice :heart_eyes:
##########
airflow/providers/amazon/aws/sensors/glue.py:
##########
@@ -223,9 +220,6 @@ def poke(self, context: Context):
f": {response.get('ErrorString')}"
)
self.log.info(job_error_message)
- # TODO: remove this if block when min_airflow_version is set to
higher than 2.7.1
- if self.soft_fail:
- raise AirflowSkipException(job_error_message)
raise AirflowException(job_error_message)
Review Comment:
Not for this PR, but I keep thinking python needs a "log and raise"
function. maybe some day we can add an "also log" flag to
AirflowException.....
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]