Exemplo n.º 1
0
    def test_utils_stop_training_job(self):
        mock_sm_client = MagicMock()
        mock_sm_client.stop_training_job.return_value = None

        response = _utils.stop_training_job(mock_sm_client, 'FakeJobName')

        mock_sm_client.stop_training_job.assert_called_once_with(
            TrainingJobName='FakeJobName')
        self.assertEqual(response, None)
Exemplo n.º 2
0
    def test_utils_stop_training_job(self):
        mock_sm_client = MagicMock()
        mock_sm_client.stop_training_job.return_value = 'FakeJobName'

        mock_sm_client.describe_training_job.side_effect = [{
            "TrainingJobStatus":
            "InProgress"
        }]

        response = _utils.stop_training_job(mock_sm_client, 'FakeJobName')

        mock_sm_client.stop_training_job.assert_called_once_with(
            TrainingJobName='FakeJobName')
        self.assertEqual(response, 'FakeJobName')
Exemplo n.º 3
0
 def signal_term_handler(signalNumber, frame):
   _utils.stop_training_job(client, job_name)
   logging.info(f"Training Job: {job_name} request submitted to Stop")