Skip to content

Include last error cause in Databricks API when retry is exhausted#69238

Merged
amoghrajesh merged 4 commits into
apache:mainfrom
astronomer:enhancing-dbx-error-for-retry
Jul 6, 2026
Merged

Include last error cause in Databricks API when retry is exhausted#69238
amoghrajesh merged 4 commits into
apache:mainfrom
astronomer:enhancing-dbx-error-for-retry

Conversation

@amoghrajesh

Copy link
Copy Markdown
Contributor

The hook was discarding the underlying cause (DNS failure, 503, connection timeout) when raising after tenacity exhausted retries. All failures produced the same string, making the error unclassifiable by a retry policy. Including the last exception gives enough signal to distinguish a permanent config error from a transient API blip.

Earlier:

ERROR - Attempt 1 API Request to Databricks failed with reason: <Future at 0xffff7b93cd90 state=finished raised ConnectionError> source=airflow.task.hooks.airflow.providers.databricks.hooks.databricks.DatabricksHook loc=databricks_base.py:1134
ERROR - Attempt 2 API Request to Databricks failed with reason: <Future at 0xffff7b72e020 state=finished raised ConnectionError> source=airflow.task.hooks.airflow.providers.databricks.hooks.databricks.DatabricksHook loc=databricks_base.py:1134
ERROR - Attempt 3 API Request to Databricks failed with reason: <Future at 0xffff7b13b8e0 state=finished raised ConnectionError> source=airflow.task.hooks.airflow.providers.databricks.hooks.databricks.DatabricksHook loc=databricks_base.py:1134
ERROR - Task failed with exception source=task loc=task_runner.py:1649
AirflowException: API requests to Databricks failed 3 times. Giving up.

Now:

ERROR - Attempt 1 API Request to Databricks failed with reason: <Future at 0xffff76357df0 state=finished raised ConnectionError> source=airflow.task.hooks.airflow.providers.databricks.hooks.databricks.DatabricksHook loc=databricks_base.py:1140
ERROR - Attempt 2 API Request to Databricks failed with reason: <Future at 0xffff70137cd0 state=finished raised ConnectionError> source=airflow.task.hooks.airflow.providers.databricks.hooks.databricks.DatabricksHook loc=databricks_base.py:1140
ERROR - Attempt 3 API Request to Databricks failed with reason: <Future at 0xffff76354dc0 state=finished raised ConnectionError> source=airflow.task.hooks.airflow.providers.databricks.hooks.databricks.DatabricksHook loc=databricks_base.py:1140
ERROR - Task failed with exception source=task loc=task_runner.py:1649
AirflowException: API requests to Databricks failed 3 times (last error: HTTPSConnectionPool(host='dbc-68473ce9-7672.cloud.databricks.con', port=443): Max retries exceeded with url: /api/2.2/jobs/run-now (Caused by NameResolutionError("HTTPSConnection(host='dbc-68473ce9-7672.cloud.databricks.con', port=443): Failed to resolve 'dbc-68473ce9-7672.cloud.databricks.con' ([Errno -2] Name or service not known)"))). Giving up.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

Comment thread providers/databricks/src/airflow/providers/databricks/hooks/databricks_base.py Outdated
Comment thread providers/databricks/tests/unit/databricks/hooks/test_databricks_base.py Outdated
@amoghrajesh amoghrajesh requested a review from Lee-W July 6, 2026 07:42
@amoghrajesh amoghrajesh merged commit f622562 into apache:main Jul 6, 2026
82 checks passed
@amoghrajesh amoghrajesh deleted the enhancing-dbx-error-for-retry branch July 6, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants