Fix coroutine serialization error in PowerBIDatasetRefreshOperator#63829
Fix coroutine serialization error in PowerBIDatasetRefreshOperator#63829henry3260 wants to merge 1 commit intoapache:mainfrom
Conversation
|
cc @morelgeorge |
SameerMesiah97
left a comment
There was a problem hiding this comment.
I think you found the cause but I feel the fix might be at the wrong layer. Also, did you manage to reproduce the bug locally?
providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/powerbi.py
Outdated
Show resolved
Hide resolved
Thanks for reviewing! Yes, I reproduced the error locally with the unit test. |
8b7e0c8 to
0593eae
Compare
|
Hello @henry3260, The connection is defined directly in UI. In case the wait_for_completion is set to True, DAG works fine. So, it seems that once you run it synchronously through asyncio.run() then get_async_conn does not work properly. I did a quick test to test this behaviour. I changed line 583 in msgraph hook in method Then wait_for_completion works fine - even for True or False |
providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/powerbi.py
Outdated
Show resolved
Hide resolved
0593eae to
395b3a3
Compare
Hi @morelgeorge! Thanks for the information! I think this version is better and will avoid the above error. |
providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/powerbi.py
Outdated
Show resolved
Hide resolved
395b3a3 to
9dacf17
Compare
Why
When the
PowerBIDatasetRefreshOperatoris executed withwait_for_completion=False, it takes the synchronous"fire-and-forget" path. However, the underlying hook methodtrigger_dataset_refreshis an async function.What
Forced Synchronous Execution: Wrapped the
hook.trigger_dataset_refresh(...)call withasyncio.run(...)inside thewait_for_completion=Falseblock. This ensures the async hook method executes fully within the current synchronous thread and returns the actual string ID.closes: #63811
Was generative AI tooling used to co-author this PR?
{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.