You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/11/22 11:36:04 UTC

[GitHub] [airflow] freget opened a new issue, #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN

freget opened a new issue, #27830:
URL: https://github.com/apache/airflow/issues/27830

   ### Apache Airflow Provider(s)
   
   databricks
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-databricks      3.3.0
   
   ### Apache Airflow version
   
   2.4.3
   
   ### Operating System
   
   Debian Bullseye
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   When switching from DatabricksSubmitRunOperator to DatabricksSubmitRunDeferrableOperator, fetching AAD tokens seems to run into a timeout problem. 
   
   Here is the relevant log extract:
       
       [2022-11-22 11:31:17,821] {triggerer_job.py:359} INFO - Trigger <airflow.providers.databricks.triggers.databricks.DatabricksExecutionTrigger run_id=17258479, databricks_conn_id=databricks, polling_period_seconds=30> (ID 47143) starting
       [2022-11-22 11:31:17,936] {base.py:71} INFO - Using connection ID 'databricks' for task execution.
       [2022-11-22 11:31:19,076] {databricks_base.py:458} INFO - Using AAD Token for SPN.
       [2022-11-22 11:31:19,077] {databricks_base.py:288} INFO - Existing AAD token is expired, or going to expire soon. Refreshing...
       [2022-11-22 11:31:19,083] {base_events.py:1900} WARNING - Executing <Task pending name='Task-9' coro=<TriggerRunner.run_trigger() running at /home/airflow/.local/lib/python3.9/site-packages/airflow/jobs/triggerer_job.py:361> wait_for=<Future pending cb=[shield.<locals>._outer_done_callback() at /usr/local/lib/python3.9/asyncio/tasks.py:907, <TaskWakeupMethWrapper object at 0x7f2f661eeeb0>()] created at /usr/local/lib/python3.9/asyncio/base_events.py:429> created at /usr/local/lib/python3.9/asyncio/tasks.py:361> took 1.262 seconds
       [2022-11-22 11:31:19,086] {triggerer_job.py:344} ERROR - Triggerer's async thread was blocked for 1.28 seconds, likely by a badly-written trigger. Set PYTHONASYNCIODEBUG=1 to get more information on overrunning coroutines.
       [2022-11-22 11:31:30,111] {triggerer_job.py:306} ERROR - Trigger <airflow.providers.databricks.triggers.databricks.DatabricksExecutionTrigger run_id=17258479, databricks_conn_id=databricks, polling_period_seconds=30> (ID 47143) exited with error 
       Traceback (most recent call last):
       File "/home/airflow/.local/lib/python3.9/site-packages/airflow/jobs/triggerer_job.py", line 297, in cleanup_finished_triggers
       result = details["task"].result()
       File "/home/airflow/.local/lib/python3.9/site-packages/airflow/jobs/triggerer_job.py", line 361, in run_trigger
       async for event in trigger.run():
       File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/databricks/triggers/databricks.py", line 66, in run
       run_page_url = await self.hook.a_get_run_page_url(self.run_id)
       File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/databricks/hooks/databricks.py", line 221, in a_get_run_page_url
       response = await self._a_do_api_call(GET_RUN_ENDPOINT, json)
       File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/databricks/hooks/databricks_base.py", line 555, in _a_do_api_call
       token = await self._a_get_token()
       File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/databricks/hooks/databricks_base.py", line 459, in _a_get_token
       return await self._a_get_aad_token(DEFAULT_DATABRICKS_SCOPE)
       File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/databricks/hooks/databricks_base.py", line 290, in _a_get_aad_token
       async for attempt in self._a_get_retry_object():
       File "/home/airflow/.local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 69, in __anext__
       do = self.iter(retry_state=self._retry_state)
       File "/home/airflow/.local/lib/python3.9/site-packages/tenacity/__init__.py", line 351, in iter
         return fut.result()
       File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 439, in result
         return self.__get_result()
       File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
         raise self._exception
       File "/home/airflow/.local/lib/python3.9/site-packages/airflow/providers/databricks/hooks/databricks_base.py", line 316, in _a_get_aad_token
         async with self._session.post(
       File "/home/airflow/.local/lib/python3.9/site-packages/aiohttp/client.py", line 1141, in __aenter__
         self._resp = await self._coro
       File "/home/airflow/.local/lib/python3.9/site-packages/aiohttp/client.py", line 637, in _request
         break
       File "/home/airflow/.local/lib/python3.9/site-packages/aiohttp/helpers.py", line 720, in __exit__
         raise asyncio.TimeoutError from None
       asyncio.exceptions.TimeoutError
       [2022-11-22 11:26:28,730] {triggerer_job.py:317} ERROR - Trigger <airflow.providers.databricks.triggers.databricks.DatabricksExecutionTrigger run_id=17258469, databricks_conn_id=databricks, polling_period_seconds=30> (ID 47142) exited without sending an event. Dependent tasks will be failed.
   
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   Create a databricks connection agains a Azure Databricks Workspace with authentication configured using service principal components.
   Then, when creating a DAG with a DatabricksSubmitRunDeferrableOperator, the error should arise (at least if your AD is as slow as ours to respond).
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] clairezhuang commented on issue #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN

Posted by GitBox <gi...@apache.org>.
clairezhuang commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1363804557

   Thanks for your response.
   IP access lists enabled but have not been changed and it is an intermitent issue, the issue might be not about IP access lists.
   And it has not enabled private link.
   Could it be related with airflow?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN
URL: https://github.com/apache/airflow/issues/27830


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] amit1510 commented on issue #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN

Posted by GitBox <gi...@apache.org>.
amit1510 commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1352633287

   Wanted to share some logs. As I got the same error.
   Also note the 'Using AAD Token for SPN' msg gets logged 2 times.
   
   [2022-12-14T17:04:16.244+0000] {databricks_base.py:295} INFO - Using AAD Token for SPN.
   [2022-12-14T17:04:16.244+0000] {databricks_base.py:181} INFO - Existing AAD token is expired, or going to expire soon. Refreshing...
   [2022-12-14T17:04:17.170+0000] {databricks.py:75} INFO - Run submitted with run_id: ********
   **[2022-12-14T17:04:17.172+0000] {databricks_base.py:295} INFO - Using AAD Token for SPN.
   [2022-12-14T17:04:17.348+0000] {databricks_base.py:295} INFO - Using AAD Token for SPN.**
   ..
   ..
   <
   
   **Then I poll for databricks job status every 30 secs. 
   And airflow receives the status multiple time as ‘Pending’ (probably cluster is still starting)
   However later I get errors as highlight below** 
   >
   …
   ..
   [2022-12-14T17:11:19.460+0000] {databricks.py:99} INFO - Sleeping for 30 seconds.
   [2022-12-14T17:11:49.487+0000] {databricks_base.py:295} INFO - Using AAD Token for SPN.
   [2022-12-14T17:11:49.556+0000] {taskinstance.py:1851} ERROR - Task failed with exception
   Traceback (most recent call last):
     File "/opt/bitnami/airflow/venv/lib/python3.9/site-packages/airflow/providers/databricks/hooks/databricks_base.py", line 347, in _do_api_call
       for attempt in self._get_retry_object():
     File "/opt/bitnami/airflow/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 384, in __iter__
       do = self.iter(retry_state=retry_state)
     File "/opt/bitnami/airflow/venv/lib/python3.9/site-packages/tenacity/__init__.py", line 351, in iter
       return fut.result()
     File "/opt/bitnami/python/lib/python3.9/concurrent/futures/_base.py", line 439, in result
       return self.__get_result()
     File "/opt/bitnami/python/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
       raise self._exception
     File "/opt/bitnami/airflow/venv/lib/python3.9/site-packages/airflow/providers/databricks/hooks/databricks_base.py", line 357, in _do_api_call
       response.raise_for_status()
     File "/opt/bitnami/airflow/venv/lib/python3.9/site-packages/requests/models.py", line 953, in raise_for_status
       raise HTTPError(http_error_msg, response=self)
   requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://adb-************.azuredatabricks.net/api/2.1/jobs/runs/get?run_id=*********
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/opt/bitnami/airflow/dags/operators/databricks_operator/base_databricks_submit_operator.py", line 151, in execute
       super().execute(context)
     File "/opt/bitnami/airflow/venv/lib/python3.9/site-packages/airflow/providers/databricks/operators/databricks.py", line 339, in execute
       _handle_databricks_operator_execution(self, hook, self.log, context)
     File "/opt/bitnami/airflow/venv/lib/python3.9/site-packages/airflow/providers/databricks/operators/databricks.py", line 82, in _handle_databricks_operator_execution
       run_state = hook.get_run_state(operator.run_id)
     File "/opt/bitnami/airflow/venv/lib/python3.9/site-packages/airflow/providers/databricks/hooks/databricks.py", line 226, in get_run_state
       response = self._do_api_call(GET_RUN_ENDPOINT, json)
     File "/opt/bitnami/airflow/venv/lib/python3.9/site-packages/airflow/providers/databricks/hooks/databricks_base.py", line 362, in _do_api_call
       raise AirflowException(f'Response: {e.response.content}, Status Code: {e.response.status_code}')
   airflow.exceptions.AirflowException: Response: b'{"error_code":"403","message":"Unauthorized access to Org: **************}’, Status Code: 403


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] clairezhuang commented on issue #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN

Posted by GitBox <gi...@apache.org>.
clairezhuang commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1371829492

   The job runs 5-10 minutes and thanks for your suggestions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] alexott commented on issue #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN

Posted by GitBox <gi...@apache.org>.
alexott commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1363832336

   Not sure. How long the job was running? As I remember, AAD token should be refreshed 5 minutes before expiration. Maybe something is incorrect in the retry logic, or something like that. Can you collect debug logs?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] alexott commented on issue #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN

Posted by GitBox <gi...@apache.org>.
alexott commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1358946544

   Such error usually means that workspace:
   
   * either has IP access lists enabled and access happens from the network that isn’t in list
   * or it has private link enabled with public access disabled and access happens via internet, not via azure backbone 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1951819077

   This issue has been closed because it has not received response from the issue author.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1901815528

   This issue has been automatically marked as stale because it has been open for 365 days without any activity. There has been several Airflow releases since last activity on this issue. Kindly asking to recheck the report against latest Airflow version and let us know if the issue is reproducible. The issue will be closed in next 30 days if no further activity occurs from the issue author.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on issue #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN

Posted by GitBox <gi...@apache.org>.
potiuk commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1330310741

   @alexott -> maybe. you/someone from Databricks can take a look at that one?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] alexott commented on issue #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN

Posted by GitBox <gi...@apache.org>.
alexott commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1330319508

   Assign it to me, I'll look or find someone to look. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] clairezhuang commented on issue #27830: DatabricksSubmitRunDeferrableOperator runs in timeout when using AAD Token for SPN

Posted by GitBox <gi...@apache.org>.
clairezhuang commented on issue #27830:
URL: https://github.com/apache/airflow/issues/27830#issuecomment-1358767741

   Hi,
   
   This is Claire from Azure Databricks Support team. I want to share the same error:
   INFO - Using AAD Token for SPN.
   INFO - Existing AAD token is expired, or going to expire soon. Refreshing...
   ......
   requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: ***********
   ......
   airflow.exceptions.AirflowException: Response: b'{"error_code":"403","message":"Unauthorized access to Org: ****************"}', Status Code: 403
   
   since the mentioned job url in the provided logs was executed successfully from Databricks side, may I know if there would be more information shared from Airflow?
   Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org