amoghrajesh commented on code in PR #76295:
URL: https://github.com/apache/airflow/pull/76295#discussion_r4520644887
##########
providers/databricks/tests/unit/databricks/operators/test_databricks.py:
##########
@@ -5267,3 +5269,293 @@ def
test_monitor_waits_out_waiting_for_retry_state(self, mock_databricks_hook, m
operator.monitor_databricks_job()
assert mock_databricks_hook.return_value.get_run.call_count == 3
+
+
[email protected](
+ not AIRFLOW_V_3_3_PLUS, reason="task_state_store (durable execution)
requires Airflow 3.3+"
+)
+class TestDatabricksTaskBaseOperatorDurable:
+ @pytest.fixture(params=["notebook", "task"])
+ def make_operator(self, request):
+ def _make(**kwargs):
+ if request.param == "notebook":
+ return DatabricksNotebookOperator(
+ task_id=TASK_ID,
+ notebook_path="/test",
+ source="WORKSPACE",
+ new_cluster=NEW_CLUSTER,
+ **kwargs,
+ )
+ return DatabricksTaskOperator(
+ task_id=TASK_ID,
+ task_config={"notebook_task": NOTEBOOK_TASK},
+ new_cluster=NEW_CLUSTER,
+ **kwargs,
+ )
+
+ return _make
+
+ @staticmethod
+ def _task_store(stored_run_id=None):
+ task_store = MagicMock(spec_set=["get", "set"])
+ task_store.get.return_value = stored_run_id
+ return task_store
+
+
@mock.patch("airflow.providers.databricks.operators.databricks.DatabricksHook")
+ def test_persists_run_id_on_fresh_submit(self, db_mock_class,
make_operator):
Review Comment:
Added `test_persists_run_id_even_if_the_page_url_lookup_fails` to
`TestDatabricksTaskBaseOperatorDurable`: get_run_page_url raises, and
task_state_store.set is still called with the run id.
Ran your mutation to check it bites. With the lookup back inside
_launch_job, those two parametrised cases are the only failures and the other
305 stay green.
--
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]