Taragolis commented on code in PR #28039:
URL: https://github.com/apache/airflow/pull/28039#discussion_r1037832131
##########
tests/providers/amazon/aws/hooks/test_emr_containers.py:
##########
@@ -110,7 +109,9 @@ def test_query_status_polling_with_timeout(self,
mock_session):
mock_session.return_value = emr_session_mock
emr_client_mock.describe_job_run.return_value = JOB2_RUN_DESCRIPTION
- query_status =
self.emr_containers.poll_query_status(job_id="job123456",
max_polling_attempts=2)
+ query_status = self.emr_containers.poll_query_status(
+ job_id="job123456", max_polling_attempts=2, poll_interval=2
+ )
Review Comment:
Actually we do not need to wait at all but better to use `freezegun` or mock
`time.sleep` however with `poll_interval = 0` it would be run just 0.5 sec
(localy).
But also it shows that there is no validation for this value. Usual `0` for
any wait interval in general not a good idea,
because it could easily converted to something like
```python
while true:
pass # 100% core 😢 usage
```
Or in this case just exceed the limits of AWS API
##########
tests/providers/amazon/aws/hooks/test_emr_containers.py:
##########
@@ -110,7 +109,9 @@ def test_query_status_polling_with_timeout(self,
mock_session):
mock_session.return_value = emr_session_mock
emr_client_mock.describe_job_run.return_value = JOB2_RUN_DESCRIPTION
- query_status =
self.emr_containers.poll_query_status(job_id="job123456",
max_polling_attempts=2)
+ query_status = self.emr_containers.poll_query_status(
+ job_id="job123456", max_polling_attempts=2, poll_interval=2
+ )
Review Comment:
Actually we do not need to wait at all but better to use `freezegun` or mock
`time.sleep` however with `poll_interval = 0` it would be run just 0.5 sec
(localy).
But also it shows that there is no validation for this value. Usual `0` for
any wait interval in general not a good idea,
because it could easily converted to something like
```python
while True:
pass # 100% core 😢 usage
```
Or in this case just exceed the limits of AWS API
--
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]