vincbeck commented on code in PR #63829:
URL: https://github.com/apache/airflow/pull/63829#discussion_r3183726868


##########
providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/powerbi.py:
##########
@@ -121,40 +120,56 @@ def api_version(self) -> str | None:
 
     def execute(self, context: Context):
         """Refresh the Power BI Dataset."""
-        if not self.wait_for_completion:
-            # Fire and forget - synchronous execution, no deferral
-            hook = PowerBIHook(
-                conn_id=self.conn_id, proxies=self.proxies, 
api_version=self.api_version, timeout=self.timeout
-            )
-
-            dataset_refresh_id = hook.trigger_dataset_refresh(
-                dataset_id=self.dataset_id,
+        self.defer(
+            trigger=PowerBITrigger(
+                conn_id=self.conn_id,
                 group_id=self.group_id,
+                dataset_id=self.dataset_id,
+                timeout=self.timeout,
+                proxies=self.proxies,
+                api_version=self.api_version,
+                check_interval=self.check_interval,
+                wait_for_termination=False,
                 request_body=self.request_body,
+            ),
+            method_name=self.handle_refresh.__name__,
+        )
+
+    def handle_refresh(self, context: Context, event: dict[str, str] | None) 
-> None:
+        """
+        Handle refresh-trigger event and optionally defer again to wait for 
refresh completion.
+
+        :param context: Airflow context dictionary
+        :param event: Event dict from trigger with status and 
dataset_refresh_id
+        """
+        if not event:
+            return
+
+        dataset_refresh_id = event.get("dataset_refresh_id")
+        if dataset_refresh_id:
+            context["ti"].xcom_push(
+                key=f"{self.task_id}.powerbi_dataset_refresh_id",

Review Comment:
   Good point, I think it is fine



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to