5050from sagemaker .workflow .entities import PipelineVariable
5151from sagemaker .workflow .functions import Join , JsonGet
5252from sagemaker .workflow .retry import RetryPolicy
53+ from sagemaker .workflow .utilities import trim_request_dict
5354
5455if TYPE_CHECKING :
5556 from sagemaker .workflow .step_collections import StepCollection
@@ -471,9 +472,10 @@ def arguments(self) -> RequestType:
471472 """The arguments dictionary that is used to call `create_training_job`.
472473
473474 NOTE: The `CreateTrainingJob` request is not quite the args list that workflow needs.
474- The `TrainingJobName` and ` ExperimentConfig` attributes cannot be included.
475+ ` ExperimentConfig` attribute cannot be included.
475476 """
476477 from sagemaker .workflow .utilities import execute_job_functions
478+ from sagemaker .workflow .utilities import _pipeline_config
477479
478480 if self .step_args :
479481 # execute fit function with saved parameters,
@@ -493,7 +495,9 @@ def arguments(self) -> RequestType:
493495 if "HyperParameters" in request_dict :
494496 request_dict ["HyperParameters" ].pop ("sagemaker_job_name" , None )
495497
496- request_dict .pop ("TrainingJobName" , None )
498+ # Continue to pop job name if not explicitly opted-in via config
499+ request_dict = trim_request_dict (request_dict , "TrainingJobName" , _pipeline_config )
500+
497501 Step ._trim_experiment_config (request_dict )
498502
499503 return request_dict
@@ -595,8 +599,8 @@ def arguments(self) -> RequestType:
595599 """The arguments dictionary that is used to call `create_model`.
596600
597601 NOTE: The `CreateModelRequest` is not quite the args list that workflow needs.
598- `ModelName` cannot be included in the arguments.
599602 """
603+ from sagemaker .workflow .utilities import _pipeline_config
600604
601605 if self .step_args :
602606 request_dict = self .step_args
@@ -620,7 +624,9 @@ def arguments(self) -> RequestType:
620624 vpc_config = self .model .vpc_config ,
621625 enable_network_isolation = self .model .enable_network_isolation (),
622626 )
623- request_dict .pop ("ModelName" , None )
627+
628+ # Continue to pop job name if not explicitly opted-in via config
629+ request_dict = trim_request_dict (request_dict , "ModelName" , _pipeline_config )
624630
625631 return request_dict
626632
@@ -702,9 +708,10 @@ def arguments(self) -> RequestType:
702708 """The arguments dictionary that is used to call `create_transform_job`.
703709
704710 NOTE: The `CreateTransformJob` request is not quite the args list that workflow needs.
705- `TransformJobName` and ` ExperimentConfig` cannot be included in the arguments.
711+ `ExperimentConfig` cannot be included in the arguments.
706712 """
707713 from sagemaker .workflow .utilities import execute_job_functions
714+ from sagemaker .workflow .utilities import _pipeline_config
708715
709716 if self .step_args :
710717 # execute transform function with saved parameters,
@@ -733,7 +740,9 @@ def arguments(self) -> RequestType:
733740 ** transform_args
734741 )
735742
736- request_dict .pop ("TransformJobName" , None )
743+ # Continue to pop job name if not explicitly opted-in via config
744+ request_dict = trim_request_dict (request_dict , "TransformJobName" , _pipeline_config )
745+
737746 Step ._trim_experiment_config (request_dict )
738747
739748 return request_dict
@@ -864,9 +873,10 @@ def arguments(self) -> RequestType:
864873 """The arguments dictionary that is used to call `create_processing_job`.
865874
866875 NOTE: The `CreateProcessingJob` request is not quite the args list that workflow needs.
867- `ProcessingJobName` and ` ExperimentConfig` cannot be included in the arguments.
876+ `ExperimentConfig` cannot be included in the arguments.
868877 """
869878 from sagemaker .workflow .utilities import execute_job_functions
879+ from sagemaker .workflow .utilities import _pipeline_config
870880
871881 if self .step_args :
872882 # execute run function with saved parameters,
@@ -890,7 +900,9 @@ def arguments(self) -> RequestType:
890900 )
891901 request_dict = self .processor .sagemaker_session ._get_process_request (** process_args )
892902
893- request_dict .pop ("ProcessingJobName" , None )
903+ # Continue to pop job name if not explicitly opted-in via config
904+ request_dict = trim_request_dict (request_dict , "ProcessingJobName" , _pipeline_config )
905+
894906 Step ._trim_experiment_config (request_dict )
895907
896908 return request_dict
@@ -1025,9 +1037,9 @@ def arguments(self) -> RequestType:
10251037
10261038 NOTE: The `CreateHyperParameterTuningJob` request is not quite the
10271039 args list that workflow needs.
1028- The `HyperParameterTuningJobName` attribute cannot be included.
10291040 """
10301041 from sagemaker .workflow .utilities import execute_job_functions
1042+ from sagemaker .workflow .utilities import _pipeline_config
10311043
10321044 if self .step_args :
10331045 # execute fit function with saved parameters,
@@ -1048,7 +1060,11 @@ def arguments(self) -> RequestType:
10481060 tuner_args = _TuningJob ._get_tuner_args (self .tuner , self .inputs )
10491061 request_dict = self .tuner .sagemaker_session ._get_tuning_request (** tuner_args )
10501062
1051- request_dict .pop ("HyperParameterTuningJobName" , None )
1063+ # Continue to pop job name if not explicitly opted-in via config
1064+ request_dict = trim_request_dict (
1065+ request_dict , "HyperParameterTuningJobName" , _pipeline_config
1066+ )
1067+
10521068 return request_dict
10531069
10541070 @property
0 commit comments