amoghrajesh commented on code in PR #76964:
URL: https://github.com/apache/airflow/pull/76964#discussion_r4611493745
##########
providers/amazon/src/airflow/providers/amazon/aws/operators/sagemaker.py:
##########
@@ -1328,7 +1328,7 @@ def execute(self, context: Context) -> dict:
self.execute_resumable(context)
# On reconnect the mixin returns poll_until_complete's value and never
calls
# get_job_result, so the result is read off the operator instead.
- return cast("dict[str, dict]", self._result)
+ return {"Training": self.serialized_training_data}
Review Comment:
Done
##########
providers/amazon/tests/unit/amazon/aws/operators/test_sagemaker_training.py:
##########
@@ -185,13 +185,18 @@ def test_durable_persists_the_submitted_job_name(self, _,
mock_training, mock_de
@mock.patch.object(SageMakerHook, "create_training_job")
@mock.patch.object(sagemaker, "serialize", return_value="")
@mock.patch.object(SageMakerHook, "configure_s3_resources")
+ @mock.patch.object(SageMakerHook, "stop_training_job")
def test_durable_reconnects_to_a_running_job(
- self, mock_configure_s3, _, mock_training, mock_desc, mock_poll
+ self, mock_stop, mock_configure_s3, _, mock_training, mock_desc,
mock_poll
):
mock_desc.return_value = {"TrainingJobStatus": "InProgress"}
+ self.sagemaker.cancel_on_kill = True
store = self._task_state_store("previously_running_job")
result = self.sagemaker.execute({"task_state_store": store})
+ self.sagemaker.on_kill()
Review Comment:
`on_kill()` now fires from the poll side effect, same shape as the submit
test.
--
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]