Skip to content

Commit e521b87

Browse files
NeilJonkersEC2 Default Userahsan-z-khanshreyapandit
authored
fix: issue #2253 where Processing job in Local mode would call Describe… (#2282)
Co-authored-by: EC2 Default User <[email protected]> Co-authored-by: Ahsan Khan <[email protected]> Co-authored-by: Shreya Pandit <[email protected]>
1 parent 16c4a7e commit e521b87

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/sagemaker/local/local_session.py

+15
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,21 @@ def logs_for_job(self, job_name, wait=False, poll=5, log_type="All"):
571571
# on local mode.
572572
pass # pylint: disable=unnecessary-pass
573573

574+
def logs_for_processing_job(self, job_name, wait=False, poll=10):
575+
"""A no-op method meant to override the sagemaker client.
576+
577+
Args:
578+
job_name:
579+
wait: (Default value = False)
580+
poll: (Default value = 10)
581+
582+
Returns:
583+
584+
"""
585+
# override logs_for_job() as it doesn't need to perform any action
586+
# on local mode.
587+
pass # pylint: disable=unnecessary-pass
588+
574589

575590
class file_input(object):
576591
"""Amazon SageMaker channel configuration for FILE data sources, used in local mode."""

tests/unit/test_local_session.py

+14
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,20 @@ def test_describe_transform_job_does_not_exist(LocalSession, _LocalTransformJob)
551551
local_sagemaker_client.describe_transform_job("transform-job-does-not-exist")
552552

553553

554+
@patch("sagemaker.local.image._SageMakerContainer.process")
555+
@patch("sagemaker.local.local_session.LocalSession")
556+
def test_logs_for_job(process, LocalSession):
557+
local_job_logs = LocalSession.logs_for_job("my-processing-job")
558+
assert local_job_logs is not None
559+
560+
561+
@patch("sagemaker.local.image._SageMakerContainer.process")
562+
@patch("sagemaker.local.local_session.LocalSession")
563+
def test_logs_for_processing_job(process, LocalSession):
564+
local_processing_job_logs = LocalSession.logs_for_processing_job("my-processing-job")
565+
assert local_processing_job_logs is not None
566+
567+
554568
@patch("sagemaker.local.local_session.LocalSession")
555569
def test_describe_endpoint_config(LocalSession):
556570
local_sagemaker_client = sagemaker.local.local_session.LocalSagemakerClient()

0 commit comments

Comments
 (0)