Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
fix: add callback method
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebecca Graber committed Dec 11, 2023
1 parent ec5500d commit 313cda5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tubular/scripts/retrieve_latest_base_ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from tubular import ec2 # pylint: disable=wrong-import-position

logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)


@click.command("retrieve_latest_base_ami")
Expand Down Expand Up @@ -111,6 +112,15 @@ def retrieve_latest_base_ami(environment, deployment, play, override, ubuntu_ver

sys.exit(0)


def _backoff_logger(details):
log.warning(
"Backing off {wait:0.1f} seconds afters {tries} tries "
"calling function {target} with args {args} and kwargs "
"{kwargs}".format(**details)
)


@backoff.on_exception(
backoff.expo,
requests.exceptions.RequestException,
Expand All @@ -120,5 +130,6 @@ def get_with_retry(url):
data = requests.get(url)
return data


if __name__ == "__main__":
retrieve_latest_base_ami() # pylint: disable=no-value-for-parameter

0 comments on commit 313cda5

Please sign in to comment.