From 278d763d9dd7f5e026b1c44f31d476b67f9c3dd3 Mon Sep 17 00:00:00 2001 From: Karim Nakad Date: Fri, 20 Sep 2019 08:36:19 -0700 Subject: [PATCH] fix: correct airflow workflow for BYO estimators. The airflow workflow for BYO estimators has been broken since a fix made on 09/13/2019. This resolves that issue. Tests to ensure this does not happen again will be added as part of the next airflow commit that prepares training jobs as part of defining training configuration. --- src/sagemaker/estimator.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/sagemaker/estimator.py b/src/sagemaker/estimator.py index bac0bbe7a9..cdeb2c610c 100644 --- a/src/sagemaker/estimator.py +++ b/src/sagemaker/estimator.py @@ -561,7 +561,7 @@ def model_data(self): )["ModelArtifacts"]["S3ModelArtifacts"] else: logging.warning( - "No finished training job found associated with this estimator. Please make sure" + "No finished training job found associated with this estimator. Please make sure " "this estimator is only used for building workflow config" ) model_uri = os.path.join( @@ -718,21 +718,20 @@ def transformer( if self.latest_training_job is None: logging.warning( - "No finished training job found associated with this estimator. Please make sure" + "No finished training job found associated with this estimator. Please make sure " "this estimator is only used for building workflow config" ) model_name = self._current_job_name else: model_name = self.latest_training_job.name + model = self.create_model(vpc_config_override=vpc_config_override) - model = self.create_model(vpc_config_override=vpc_config_override) + # not all create_model() implementations have the same kwargs + model.name = model_name + if role is not None: + model.role = role - # not all create_model() implementations have the same kwargs - model.name = model_name - if role is not None: - model.role = role - - model._create_sagemaker_model(instance_type, tags=tags) + model._create_sagemaker_model(instance_type, tags=tags) return Transformer( model_name, @@ -1716,7 +1715,7 @@ def transformer( transform_env.update(env) else: logging.warning( - "No finished training job found associated with this estimator. Please make sure" + "No finished training job found associated with this estimator. Please make sure " "this estimator is only used for building workflow config" ) model_name = self._current_job_name