From 5383bd0c67bbe3793276442dc351c90a5c3b94e8 Mon Sep 17 00:00:00 2001 From: rajaths010494 Date: Thu, 30 Mar 2023 12:37:57 +0530 Subject: [PATCH] Fix review comments --- airflow/providers/amazon/aws/hooks/batch_client.py | 6 ++---- docs/apache-airflow-providers-amazon/operators/batch.rst | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/airflow/providers/amazon/aws/hooks/batch_client.py b/airflow/providers/amazon/aws/hooks/batch_client.py index ff116aa8b1f5..78abea150ab9 100644 --- a/airflow/providers/amazon/aws/hooks/batch_client.py +++ b/airflow/providers/amazon/aws/hooks/batch_client.py @@ -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 @@ -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) diff --git a/docs/apache-airflow-providers-amazon/operators/batch.rst b/docs/apache-airflow-providers-amazon/operators/batch.rst index ba280cb38d37..8a2d94dda149 100644 --- a/docs/apache-airflow-providers-amazon/operators/batch.rst +++ b/docs/apache-airflow-providers-amazon/operators/batch.rst @@ -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