Skip to content

Commit bfe7fa2

Browse files
committed
change: push powerbi_dataset_refresh_status before raising exception
1 parent 18648a1 commit bfe7fa2

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

providers/src/airflow/providers/microsoft/azure/operators/powerbi.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,10 @@ def execute_complete(self, context: Context, event: dict[str, str]) -> Any:
153153
Relies on trigger to throw an exception, otherwise it assumes execution was successful.
154154
"""
155155
if event:
156-
if event["status"] == "error":
157-
raise AirflowException(event["message"])
158-
159156
self.xcom_push(
160157
context=context,
161158
key=f"{self.task_id}.powerbi_dataset_refresh_status",
162159
value=event["dataset_refresh_status"],
163160
)
161+
if event["status"] == "error":
162+
raise AirflowException(event["message"])

providers/tests/microsoft/azure/operators/test_powerbi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def test_powerbi_operator_async_execute_complete_fail(self):
144144
"dataset_refresh_id": "1234",
145145
},
146146
)
147-
assert context["ti"].xcom_push.call_count == 0
147+
assert context["ti"].xcom_push.call_count == 1
148148
assert str(exc.value) == "error"
149149

150150
def test_powerbi_operator_refresh_fail(self):
@@ -163,7 +163,7 @@ def test_powerbi_operator_refresh_fail(self):
163163
"dataset_refresh_id": "1234",
164164
},
165165
)
166-
assert context["ti"].xcom_push.call_count == 0
166+
assert context["ti"].xcom_push.call_count == 1
167167
assert str(exc.value) == "error message"
168168

169169
def test_execute_complete_no_event(self):

0 commit comments

Comments
 (0)