Skip to content

Commit

Permalink
Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rajaths010494 committed Apr 4, 2023
1 parent eb05be7 commit 5383bd0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 2 additions & 4 deletions airflow/providers/amazon/aws/hooks/batch_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from __future__ import annotations

import asyncio
from random import sample, uniform
from random import uniform
from time import sleep
from typing import Any

Expand Down Expand Up @@ -641,9 +641,7 @@ async def delay(delay: int | float | None = None) -> None: # type: ignore[overr
when many concurrent tasks request job-descriptions.
"""
if delay is None:
delay = sample(
list(range(BatchClientAsyncHook.DEFAULT_DELAY_MIN, BatchClientAsyncHook.DEFAULT_DELAY_MAX)), 1
)[0]
delay = uniform(BatchClientHook.DEFAULT_DELAY_MIN, BatchClientHook.DEFAULT_DELAY_MAX)
else:
delay = BatchClientAsyncHook.add_jitter(delay)
await asyncio.sleep(delay)
Expand Down
1 change: 1 addition & 0 deletions docs/apache-airflow-providers-amazon/operators/batch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Submit a new AWS Batch job
==========================

To submit a new AWS Batch job and monitor it until it reaches a terminal state you can
also run this operator in deferrable mode by setting ``deferrable`` param to ``True``.
use :class:`~airflow.providers.amazon.aws.operators.batch.BatchOperator`.

.. exampleinclude:: /../../tests/system/providers/amazon/aws/example_batch.py
Expand Down

0 comments on commit 5383bd0

Please sign in to comment.