@@ -176,7 +176,7 @@ def conda_env_yml():
176176 os .remove (conda_yml_file_name )
177177
178178
179- def _build_container (sagemaker_session , py_version , docker_templete ):
179+ def _build_container (sagemaker_session , py_version , docker_template ):
180180 """Build a dummy test container locally and push a container to an ecr repo"""
181181
182182 region = sagemaker_session .boto_region_name
@@ -189,9 +189,9 @@ def _build_container(sagemaker_session, py_version, docker_templete):
189189 print ("building source archive..." )
190190 source_archive = _generate_sagemaker_sdk_tar (tmpdir )
191191 with open (os .path .join (tmpdir , "Dockerfile" ), "w" ) as file :
192- file . writelines (
193- docker_templete . format ( py_version = py_version , source_archive = source_archive )
194- )
192+ content = docker_template . format ( py_version = py_version , source_archive = source_archive )
193+ print ( f"Dockerfile contents: \n { content } \n " )
194+ file . writelines ( content )
195195
196196 docker_client = docker .from_env ()
197197
@@ -209,6 +209,7 @@ def _build_container(sagemaker_session, py_version, docker_templete):
209209 raise
210210
211211 if _is_repository_exists (ecr_client , REPO_NAME ):
212+ print ("pushing to session configured account id!" )
212213 sts_client = sagemaker_session .boto_session .client (
213214 "sts" , region_name = region , endpoint_url = sts_regional_endpoint (region )
214215 )
@@ -218,6 +219,7 @@ def _build_container(sagemaker_session, py_version, docker_templete):
218219 account_id , sagemaker_session .boto_region_name , REPO_NAME , image_tag
219220 )
220221 else :
222+ print (f"pushing to account id: { REPO_ACCOUNT_ID } " )
221223 ecr_image = _ecr_image_uri (
222224 REPO_ACCOUNT_ID ,
223225 sagemaker_session .boto_region_name ,
@@ -232,17 +234,17 @@ def _build_container(sagemaker_session, py_version, docker_templete):
232234 return ecr_image
233235
234236
235- def _build_auto_capture_client_container (py_version , docker_templete ):
237+ def _build_auto_capture_client_container (py_version , docker_template ):
236238 """Build a test docker container that will act as a client for auto_capture tests"""
237239 with _tmpdir () as tmpdir :
238240 print ("building docker image locally in " , tmpdir )
239241 print ("building source archive..." )
240242 source_archive = _generate_sdk_tar_with_public_version (tmpdir )
241243 _move_auto_capture_test_file (tmpdir )
242244 with open (os .path .join (tmpdir , "Dockerfile" ), "w" ) as file :
243- file . writelines (
244- docker_templete . format ( py_version = py_version , source_archive = source_archive )
245- )
245+ content = docker_template . format ( py_version = py_version , source_archive = source_archive )
246+ print ( f"Dockerfile contents: \n { content } \n " )
247+ file . writelines ( content )
246248
247249 docker_client = docker .from_env ()
248250
@@ -276,11 +278,13 @@ def _generate_sagemaker_sdk_tar(destination_folder):
276278 """
277279 Run setup.py sdist to generate the PySDK tar file
278280 """
279- subprocess .run (
280- f"python3 setup.py egg_info --egg-base { destination_folder } sdist -d { destination_folder } -k" ,
281- shell = True ,
282- check = True ,
283- )
281+ command = f"python3 setup.py egg_info --egg-base { destination_folder } sdist -d { destination_folder } -k"
282+ print (f"Running command: { command } " )
283+ result = subprocess .run (command , shell = True , check = True , capture_output = True )
284+ if result .returncode != 0 :
285+ print (f"Command failed with return code: { result .returncode } " )
286+ print (f"Standard output: { result .stdout .decode ()} " )
287+ print (f"Standard error: { result .stderr .decode ()} " )
284288 destination_folder_contents = os .listdir (destination_folder )
285289 source_archive = [file for file in destination_folder_contents if file .endswith ("tar.gz" )][0 ]
286290
0 commit comments