From f1af6110280779c555f89ea8fff832404bfa9dd4 Mon Sep 17 00:00:00 2001 From: Daniel van der Ende Date: Wed, 23 Dec 2020 10:05:16 +0100 Subject: [PATCH] Handle case of 0 connect retries better With a default of 0 connect_retries, confusing log messages show up. The logs suggest that a retry is going to be carried out, but it isn't. Also, a sleep is carried out, even if no retries are to happen. This check prevents this from happening. --- CHANGELOG.md | 6 ++++++ dbt/adapters/spark/connections.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ecd95ab..6f1db87aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ ### Under the hood - Add changelog, issue templates ([#119](https://github.com/fishtown-analytics/dbt-spark/pull/119), [#120](https://github.com/fishtown-analytics/dbt-spark/pull/120)) +### Fixes +- Handle case of 0 retries better for HTTP Spark Connections ([#132](https://github.com/fishtown-analytics/dbt-spark/pull/132)) + +### Contributors +- [@danielvdende](https://github.com/danielvdende) ([#132](https://github.com/fishtown-analytics/dbt-spark/pull/132)) + ## dbt-spark 0.18.1.1 (November 13, 2020) ### Fixes diff --git a/dbt/adapters/spark/connections.py b/dbt/adapters/spark/connections.py index d3155b30f..11592d661 100644 --- a/dbt/adapters/spark/connections.py +++ b/dbt/adapters/spark/connections.py @@ -401,7 +401,7 @@ def open(cls, connection): msg += ', is your token valid?' raise dbt.exceptions.FailedToConnectException(msg) from e retryable_message = _is_retryable_error(e) - if retryable_message: + if retryable_message and creds.connect_retries > 0: msg = ( f"Warning: {retryable_message}\n\tRetrying in " f"{creds.connect_timeout} seconds "