darrenleeweber commented on a change in pull request #6765: [WIP][AIRFLOW-5889]
Fix polling for AWS Batch job status
URL: https://github.com/apache/airflow/pull/6765#discussion_r356908610
##########
File path: airflow/contrib/operators/awsbatch_operator.py
##########
@@ -156,32 +179,68 @@ def _wait_for_task_ended(self):
waiter.config.max_attempts = sys.maxsize # timeout is managed by
airflow
waiter.wait(jobs=[self.jobId])
except ValueError:
- # If waiter not available use expo
+ self._poll_for_task_ended()
- # Allow a batch job some time to spin up. A random interval
- # decreases the chances of exceeding an AWS API throttle
- # limit when there are many concurrent tasks.
- pause = randint(5, 30)
+ def _poll_for_task_ended(self):
+ """
+ Poll for task status using a exponential backoff
- retries = 1
- while retries <= self.max_retries:
- self.log.info('AWS Batch job (%s) status check (%d of %d) in
the next %.2f seconds',
- self.jobId, retries, self.max_retries, pause)
- sleep(pause)
+ * docs.aws.amazon.com/general/latest/gr/api-retries.html
+ """
+ # Allow a batch job some time to spin up. A random interval
+ # decreases the chances of exceeding an AWS API throttle
+ # limit when there are many concurrent tasks.
+ pause = randint(5, 30)
Review comment:
The details on how quickly a batch job can possibly start are complex and
captured in some JIRA tickets related to that change (see commit message for
JIRA ticket). That was all reviewed in a prior PR, so I'd prefer not to
revisit that every time. If it must be configured, please open a new JIRA
issue for it and propose how to handle/allow the configuration options.
----------------------------------------------------------------
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