|
367 | 367 | },
|
368 | 368 | }
|
369 | 369 |
|
| 370 | +SEARCH_TRAINING_JOB_AUTOPILOT_EXAMPLE = { |
| 371 | + "Results": [ |
| 372 | + { |
| 373 | + "TrainingJob": { |
| 374 | + "TrainingJobName": TRAINING_JOB_NAME, |
| 375 | + "TrainingJobArn": TRAINING_JOB_ARN, |
| 376 | + "ModelArtifacts": {"S3ModelArtifacts": "s3://example"}, |
| 377 | + "TrainingJobOutput": {"S3TrainingJobOutput": "s3://example"}, |
| 378 | + "TrainingJobStatus": "Completed", |
| 379 | + "SecondaryStatus": "Completed", |
| 380 | + "HyperParameters": { |
| 381 | + "processor_module": "candidate_data_processors.dpp2", |
| 382 | + "sagemaker_program": "candidate_data_processors.trainer", |
| 383 | + "sagemaker_submit_directory": "/opt/ml/input/data/code", |
| 384 | + }, |
| 385 | + "AlgorithmSpecification": { |
| 386 | + "TrainingImage": TRAINING_IMAGE, |
| 387 | + "TrainingInputMode": "File", |
| 388 | + "MetricDefinitions": [], |
| 389 | + "EnableSageMakerMetricsTimeSeries": False, |
| 390 | + }, |
| 391 | + "CreatedBy": {}, |
| 392 | + } |
| 393 | + } |
| 394 | + ], |
| 395 | + "ResponseMetadata": { |
| 396 | + "RequestId": "b43aacee-c846-4ca6-b5c0-d9413cebda33", |
| 397 | + "HTTPStatusCode": 200, |
| 398 | + "HTTPHeaders": { |
| 399 | + "x-amzn-requestid": "b43aacee-c846-4ca6-b5c0-d9413cebda33", |
| 400 | + "content-type": "application/x-amz-json-1.1", |
| 401 | + "content-length": "6199", |
| 402 | + "date": "Tue, 20 Sep 2022 19:59:50 GMT", |
| 403 | + }, |
| 404 | + "RetryAttempts": 0, |
| 405 | + }, |
| 406 | +} |
| 407 | + |
370 | 408 | DESCRIBE_TRAINING_JOB_EXAMPLE = SEARCH_TRAINING_JOB_EXAMPLE["Results"][0]["TrainingJob"]
|
371 | 409 | MISSING_TRAINING_JOB_CLIENT_ERROR = ClientError(
|
372 | 410 | error_response={
|
@@ -995,6 +1033,22 @@ def test_training_details_autodiscovery_from_model_overview(
|
995 | 1033 | ) in caplog.text
|
996 | 1034 |
|
997 | 1035 |
|
| 1036 | +@patch("sagemaker.Session") |
| 1037 | +def test_training_details_autodiscovery_from_model_overview_autopilot( |
| 1038 | + session, model_overview_example, caplog |
| 1039 | +): |
| 1040 | + session.sagemaker_client.search.side_effect = [ |
| 1041 | + SEARCH_TRAINING_JOB_AUTOPILOT_EXAMPLE, |
| 1042 | + ] |
| 1043 | + |
| 1044 | + model_overview_example.model_artifact = [MODEL_ARTIFACT[0]] |
| 1045 | + training_details = TrainingDetails.from_model_overview( |
| 1046 | + model_overview=model_overview_example, sagemaker_session=session |
| 1047 | + ) |
| 1048 | + |
| 1049 | + assert len(training_details.training_job_details.training_metrics) == 0 |
| 1050 | + |
| 1051 | + |
998 | 1052 | @patch("sagemaker.Session")
|
999 | 1053 | def test_training_details_autodiscovery_from_job_name(session):
|
1000 | 1054 | session.sagemaker_client.describe_training_job.side_effect = [
|
|
0 commit comments