Skip to content

Commit 93f0f58

Browse files
committed
Address comments from Lauren
1 parent ae26887 commit 93f0f58

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/sagemaker/estimator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,13 @@ def deploy(self, initial_instance_count, instance_type, endpoint_name=None, **kw
282282
@property
283283
def model_data(self):
284284
"""str: The model location in S3. Only set if Estimator has been ``fit()``."""
285-
try:
285+
if self.latest_training_job is not None:
286286
model_uri = self.sagemaker_session.sagemaker_client.describe_training_job(
287287
TrainingJobName=self.latest_training_job.name)['ModelArtifacts']['S3ModelArtifacts']
288-
except AttributeError:
288+
else:
289289
logging.warning('No finished training job found associated with this estimator. Please make sure'
290290
'this estimator is only used for building workflow config')
291-
model_uri = os.path.join(self.output_path, self._current_job_name, 'output/model.tar.gz')
291+
model_uri = os.path.join(self.output_path, self._current_job_name, 'output', 'model.tar.gz')
292292
return model_uri
293293

294294
@abstractmethod

src/sagemaker/workflow/airflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,13 @@ def tuning_config(tuner, inputs, job_name=None):
276276

277277

278278
def prepare_framework_container_def(model, instance_type, s3_operations):
279-
"""Prepare the framework model container information. Specify related s3 operations for Airflow to perform.
279+
"""Prepare the framework model container information. Specify related S3 operations for Airflow to perform.
280280
(Upload source_dir)
281281
282282
Args:
283283
model (sagemaker.model.FrameworkModel): The framework model
284284
instance_type (str): The EC2 instance type to deploy this Model to. For example, 'ml.p2.xlarge'.
285-
s3_operations (dict): The dict to specify s3 operations (upload source_dir).
285+
s3_operations (dict): The dict to specify S3 operations (upload source_dir).
286286
287287
Returns (dict):
288288
The container information of this framework model.

tests/unit/test_airflow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,8 @@ def test_model_config_from_amazon_alg_estimator(sagemaker_session):
736736
train_instance_type='ml.m4.xlarge',
737737
k=16,
738738
sample_size=128,
739-
predictor_type='regressor')
739+
predictor_type='regressor',
740+
sagemaker_session=sagemaker_session)
740741

741742
record = amazon_estimator.RecordSet("{{ record }}", 10000, 100, 'S3Prefix')
742743

@@ -749,8 +750,7 @@ def test_model_config_from_amazon_alg_estimator(sagemaker_session):
749750
'PrimaryContainer': {
750751
'Image': '174872318107.dkr.ecr.us-west-2.amazonaws.com/knn:1',
751752
'Environment': {},
752-
'ModelDataUrl': "s3://sagemaker-us-west-2-389309777320/knn-"
753-
"{{ execution_date.strftime('%Y-%m-%d-%H-%M-%S') }}/output/model.tar.gz"},
753+
'ModelDataUrl': "s3://output/knn-{{ execution_date.strftime('%Y-%m-%d-%H-%M-%S') }}/output/model.tar.gz"},
754754
'ExecutionRoleArn': '{{ role }}'
755755
}
756756

0 commit comments

Comments
 (0)