Skip to content

Commit 09abb01

Browse files
committed
chore: rename parameter + cleanup comments
1 parent 6f4f490 commit 09abb01

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

sagemaker-mlops/src/sagemaker/mlops/feature_store/feature_processor/feature_scheduler.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
def to_pipeline(
117117
pipeline_name: str,
118118
step: Callable,
119-
role: Optional[str] = None,
119+
role_arn: Optional[str] = None,
120120
transformation_code: Optional[TransformationCode] = None,
121121
max_retries: Optional[int] = None,
122122
tags: Optional[List[Tuple[str, str]]] = None,
@@ -133,7 +133,7 @@ def to_pipeline(
133133
pipeline_name (str): The name of the pipeline.
134134
step (Callable): A user provided function wrapped by feature_processor and optionally
135135
wrapped by remote_decorator.
136-
role (Optional[str]): The Amazon Resource Name (ARN) of the role used by the pipeline to
136+
role_arn (Optional[str]): The Amazon Resource Name (ARN) of the role used by the pipeline to
137137
access and create resources. If not specified, it will default to the credentials
138138
provided by the AWS configuration chain.
139139
transformation_code (Optional[str]): The data source for a reference to the transformation
@@ -162,7 +162,7 @@ def to_pipeline(
162162
remote_decorator_config = _get_remote_decorator_config_from_input(
163163
wrapped_func=step, sagemaker_session=_sagemaker_session
164164
)
165-
_role = role or get_execution_role(_sagemaker_session)
165+
_role = role_arn or get_execution_role(_sagemaker_session)
166166

167167
runtime_env_manager = RuntimeEnvironmentManager()
168168
client_python_version = runtime_env_manager._current_python_version()
@@ -863,7 +863,7 @@ def _prepare_model_trainer_from_remote_decorator_config(
863863
"""
864864
logger.info("Mapping remote decorator config to ModelTrainer params")
865865

866-
# Build environment dict from remote_decorator_config (strings only for Pydantic validation)
866+
# Build environment dict from remote_decorator_config
867867
environment = dict(remote_decorator_config.environment_variables or {})
868868

869869
# Build command from container entry point and arguments
@@ -946,9 +946,6 @@ def _prepare_model_trainer_from_remote_decorator_config(
946946
tags=tags,
947947
)
948948

949-
# Inject SCHEDULED_TIME_PIPELINE_PARAMETER after construction to bypass Pydantic
950-
# validation (Parameter is not a string). The @runnable_by_pipeline decorator resolves
951-
# Parameter objects to strings during pipeline definition serialization.
952949
model_trainer.environment[EXECUTION_TIME_PIPELINE_PARAMETER] = SCHEDULED_TIME_PIPELINE_PARAMETER
953950

954951
logger.info(

sagemaker-mlops/tests/integ/feature_store/feature_processor/test_feature_processor_integ.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ def transform(raw_s3_data_as_df):
738738
pipeline_arn = to_pipeline(
739739
pipeline_name=pipeline_name,
740740
step=transform,
741-
role=get_execution_role(sagemaker_session),
741+
role_arn=get_execution_role(sagemaker_session),
742742
max_retries=2,
743743
tags=[("integ_test_tag_key_1", "integ_test_tag_key_2")],
744744
sagemaker_session=sagemaker_session,
@@ -861,7 +861,7 @@ def transform(raw_s3_data_as_df):
861861
pipeline_arn = to_pipeline(
862862
pipeline_name=pipeline_name,
863863
step=transform,
864-
role=get_execution_role(sagemaker_session),
864+
role_arn=get_execution_role(sagemaker_session),
865865
max_retries=2,
866866
sagemaker_session=sagemaker_session,
867867
)

sagemaker-mlops/tests/unit/sagemaker/mlops/feature_store/feature_processor/test_feature_scheduler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_to_pipeline(
275275
pipeline_arn = to_pipeline(
276276
pipeline_name="pipeline_name",
277277
step=wrapped_func,
278-
role=EXECUTION_ROLE_ARN,
278+
role_arn=EXECUTION_ROLE_ARN,
279279
max_retries=1,
280280
tags=[("tag_key_1", "tag_value_1"), ("tag_key_2", "tag_value_2")],
281281
sagemaker_session=session,
@@ -437,7 +437,7 @@ def test_to_pipeline_not_wrapped_by_feature_processor(get_execution_role, sessio
437437
to_pipeline(
438438
pipeline_name="pipeline_name",
439439
step=wrapped_func,
440-
role=EXECUTION_ROLE_ARN,
440+
role_arn=EXECUTION_ROLE_ARN,
441441
max_retries=1,
442442
)
443443

@@ -461,7 +461,7 @@ def test_to_pipeline_not_wrapped_by_remote(get_execution_role, session):
461461
to_pipeline(
462462
pipeline_name="pipeline_name",
463463
step=wrapped_func,
464-
role=EXECUTION_ROLE_ARN,
464+
role_arn=EXECUTION_ROLE_ARN,
465465
max_retries=1,
466466
)
467467

@@ -513,7 +513,7 @@ def test_to_pipeline_wrong_mode(get_execution_role, mock_spark_image, session):
513513
to_pipeline(
514514
pipeline_name="pipeline_name",
515515
step=wrapped_func,
516-
role=EXECUTION_ROLE_ARN,
516+
role_arn=EXECUTION_ROLE_ARN,
517517
max_retries=1,
518518
)
519519

@@ -568,7 +568,7 @@ def test_to_pipeline_pipeline_name_length_limit_exceeds(
568568
to_pipeline(
569569
pipeline_name="".join(["a" for _ in range(PIPELINE_NAME_MAXIMUM_LENGTH + 1)]),
570570
step=wrapped_func,
571-
role=EXECUTION_ROLE_ARN,
571+
role_arn=EXECUTION_ROLE_ARN,
572572
max_retries=1,
573573
)
574574

@@ -626,7 +626,7 @@ def test_to_pipeline_used_reserved_tags(get_execution_role, mock_spark_image, se
626626
to_pipeline(
627627
pipeline_name="pipeline_name",
628628
step=wrapped_func,
629-
role=EXECUTION_ROLE_ARN,
629+
role_arn=EXECUTION_ROLE_ARN,
630630
max_retries=1,
631631
tags=[("sm-fs-fe:created-from", "random")],
632632
sagemaker_session=session,

0 commit comments

Comments
 (0)