|
| 1 | +# %load /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/sagemaker/automl/automl.py |
1 | 2 | # Copyright 2019-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2 | 3 | #
|
3 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"). You
|
@@ -123,33 +124,34 @@ def attach(cls, job_name, sagemaker_session=None):
|
123 | 124 | amlj = AutoML(
|
124 | 125 | role=_auto_ml_job_desc["RoleArn"],
|
125 | 126 | target_attribute_name=_auto_ml_job_desc["InputDataConfig"][0]["TargetAttributeName"],
|
126 |
| - problem_type=_auto_ml_job_desc["ProblemType"], |
127 |
| - output_path=_auto_ml_job_desc["OutputDataConfig"]["S3OutputPath"], |
128 | 127 | output_kms_key=_auto_ml_job_desc["OutputDataConfig"].get("KmsKeyId"),
|
| 128 | + output_path=_auto_ml_job_desc["OutputDataConfig"]["S3OutputPath"], |
129 | 129 | base_job_name=job_name,
|
| 130 | + compression_type=_auto_ml_job_desc["InputDataConfig"][0].get("CompressionType"), |
130 | 131 | sagemaker_session=sagemaker_session,
|
131 |
| - volume_kms_key=_auto_ml_job_desc["AutoMLJobConfig"] |
| 132 | + volume_kms_key=_auto_ml_job_desc.get("AutoMLJobConfig", {}) |
132 | 133 | .get("SecurityConfig", {})
|
133 | 134 | .get("VolumeKmsKeyId"),
|
134 |
| - encrypt_inter_container_traffic=_auto_ml_job_desc["AutoMLJobConfig"] |
| 135 | + encrypt_inter_container_traffic=_auto_ml_job_desc.get("AutoMLJobConfig", {}) |
135 | 136 | .get("SecurityConfig", {})
|
136 | 137 | .get("EnableInterContainerTrafficEncryption", False),
|
137 |
| - vpc_config=_auto_ml_job_desc["AutoMLJobConfig"] |
| 138 | + vpc_config=_auto_ml_job_desc.get("AutoMLJobConfig", {}) |
138 | 139 | .get("SecurityConfig", {})
|
139 | 140 | .get("VpcConfig"),
|
140 |
| - max_candidates=_auto_ml_job_desc["AutoMLJobConfig"]["CompletionCriteria"][ |
141 |
| - "MaxCandidates" |
142 |
| - ], |
143 |
| - max_runtime_per_training_job_in_seconds=_auto_ml_job_desc["AutoMLJobConfig"][ |
144 |
| - "CompletionCriteria" |
145 |
| - ]["MaxRuntimePerTrainingJobInSeconds"], |
146 |
| - total_job_runtime_in_seconds=_auto_ml_job_desc["AutoMLJobConfig"]["CompletionCriteria"][ |
147 |
| - "MaxAutoMLJobRuntimeInSeconds" |
148 |
| - ], |
149 |
| - job_objective=_auto_ml_job_desc["AutoMLJobObjective"]["MetricName"], |
150 |
| - generate_candidate_definitions_only=_auto_ml_job_desc[ |
151 |
| - "GenerateCandidateDefinitionsOnly" |
152 |
| - ], |
| 141 | + problem_type=_auto_ml_job_desc.get("ProblemType"), |
| 142 | + max_candidates=_auto_ml_job_desc.get("AutoMLJobConfig", {}) |
| 143 | + .get("CompletionCriteria", {}) |
| 144 | + .get("MaxCandidates"), |
| 145 | + max_runtime_per_training_job_in_seconds=_auto_ml_job_desc.get("AutoMLJobConfig", {}) |
| 146 | + .get("CompletionCriteria", {}) |
| 147 | + .get("MaxRuntimePerTrainingJobInSeconds"), |
| 148 | + total_job_runtime_in_seconds=_auto_ml_job_desc.get("AutoMLJobConfig", {}) |
| 149 | + .get("CompletionCriteria", {}) |
| 150 | + .get("MaxAutoMLJobRuntimeInSeconds"), |
| 151 | + job_objective=_auto_ml_job_desc.get("AutoMLJobObjective", {}).get("MetricName"), |
| 152 | + generate_candidate_definitions_only=_auto_ml_job_desc.get( |
| 153 | + "GenerateCandidateDefinitionsOnly", False |
| 154 | + ), |
153 | 155 | tags=automl_job_tags,
|
154 | 156 | )
|
155 | 157 | amlj.current_job_name = job_name
|
|
0 commit comments