Skip to content

Commit

Permalink
Lower log levels from INFO to DEBUG to reduce log verbosity - Databri…
Browse files Browse the repository at this point in the history
…cks provider auth (apache#39941)

This helps reduce the log noise in the task logs when
operators keeps polling on the job run status. Otherwise,
for each poll, we make a HTTP request, and everytime we see
these logs increasing unnecessary verbosity.
  • Loading branch information
pankajkoti authored May 30, 2024
1 parent f04dbec commit f0ea079
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions airflow/providers/databricks/hooks/databricks_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,21 +499,21 @@ def _get_token(self, raise_error: bool = False) -> str | None:
)
return self.databricks_conn.extra_dejson["token"]
elif not self.databricks_conn.login and self.databricks_conn.password:
self.log.info("Using token auth.")
self.log.debug("Using token auth.")
return self.databricks_conn.password
elif "azure_tenant_id" in self.databricks_conn.extra_dejson:
if self.databricks_conn.login == "" or self.databricks_conn.password == "":
raise AirflowException("Azure SPN credentials aren't provided")
self.log.info("Using AAD Token for SPN.")
self.log.debug("Using AAD Token for SPN.")
return self._get_aad_token(DEFAULT_DATABRICKS_SCOPE)
elif self.databricks_conn.extra_dejson.get("use_azure_managed_identity", False):
self.log.info("Using AAD Token for managed identity.")
self.log.debug("Using AAD Token for managed identity.")
self._check_azure_metadata_service()
return self._get_aad_token(DEFAULT_DATABRICKS_SCOPE)
elif self.databricks_conn.extra_dejson.get("service_principal_oauth", False):
if self.databricks_conn.login == "" or self.databricks_conn.password == "":
raise AirflowException("Service Principal credentials aren't provided")
self.log.info("Using Service Principal Token.")
self.log.debug("Using Service Principal Token.")
return self._get_sp_token(OIDC_TOKEN_SERVICE_URL.format(self.databricks_conn.host))
elif raise_error:
raise AirflowException("Token authentication isn't configured")
Expand All @@ -527,21 +527,21 @@ async def _a_get_token(self, raise_error: bool = False) -> str | None:
)
return self.databricks_conn.extra_dejson["token"]
elif not self.databricks_conn.login and self.databricks_conn.password:
self.log.info("Using token auth.")
self.log.debug("Using token auth.")
return self.databricks_conn.password
elif "azure_tenant_id" in self.databricks_conn.extra_dejson:
if self.databricks_conn.login == "" or self.databricks_conn.password == "":
raise AirflowException("Azure SPN credentials aren't provided")
self.log.info("Using AAD Token for SPN.")
self.log.debug("Using AAD Token for SPN.")
return await self._a_get_aad_token(DEFAULT_DATABRICKS_SCOPE)
elif self.databricks_conn.extra_dejson.get("use_azure_managed_identity", False):
self.log.info("Using AAD Token for managed identity.")
self.log.debug("Using AAD Token for managed identity.")
await self._a_check_azure_metadata_service()
return await self._a_get_aad_token(DEFAULT_DATABRICKS_SCOPE)
elif self.databricks_conn.extra_dejson.get("service_principal_oauth", False):
if self.databricks_conn.login == "" or self.databricks_conn.password == "":
raise AirflowException("Service Principal credentials aren't provided")
self.log.info("Using Service Principal Token.")
self.log.debug("Using Service Principal Token.")
return await self._a_get_sp_token(OIDC_TOKEN_SERVICE_URL.format(self.databricks_conn.host))
elif raise_error:
raise AirflowException("Token authentication isn't configured")
Expand Down

0 comments on commit f0ea079

Please sign in to comment.