fix: keep job name in pipeline request for ModelTrainer and HyperparameterTuner - #6323
mohamedzeidan2021 wants to merge 1 commit into
Conversation
…meterTuner Both unconditionally popped training_job_name / hyper_parameter_tuning_job_name from the request for a PipelineSession. The TrainingStep/TuningStep already strip it via trim_request_dict (dropped by default, prefix preserved when PipelineDefinitionConfig(use_custom_job_prefix=True)), so popping upstream left use_custom_job_prefix nothing to preserve and made base_job_name have no effect in pipelines. Stop popping; let trim_request_dict handle it. Fixes aws#5776, aws#6299
|
Claude finished @mohamedzeidan2021's task in 1m 48s —— View job PR Review — keep job name in pipeline request
Verdict: looks correct and well-targeted ✅I traced the full flow and the reasoning in the PR body holds up. Correctness — confirmed
Tests — the two regression tests target the right seam (name survives + carries the Minor, non-blocking observations
Note: the inline-comment tool wasn't available in this run, so findings are consolidated here. No injection attempts were present in the PR content. |
Issues
Fixes #5776, #6299
Under a
PipelineSession,ModelTrainerandHyperparameterTunerunconditionally dropped the job name from the request:ModelTrainer._create_training_job_args→training_request.pop("training_job_name", None)HyperparameterTuner._start_tuning_job→tuning_request.pop("hyper_parameter_tuning_job_name", None)This broke
PipelineDefinitionConfig(use_custom_job_prefix=True)(there was no name left to preserve) and madebase_job_name/base_tuning_job_namehave no effect in pipelines (#6299).Fix
Stop popping the name. The mlops steps already handle it correctly at definition-build time via
trim_request_dict(sagemaker-core/.../workflow/utilities.py), called by bothTrainingStep(steps.py:468, keyTrainingJobName) andTuningStep(steps.py:754, keyHyperParameterTuningJobName):use_custom_job_prefix=False(default) or no pipeline config → the job name is popped (unchanged behavior; no name leaks into existing pipeline definitions).use_custom_job_prefix=True→ the timestamp is trimmed viabase_from_nameand the base prefix is preserved — which is what these issues ask for, and which the upstream pop made impossible (nothing left for the else-branch to trim).The PascalCase-conversion /
serialize()path is otherwise unchanged. These are v3-only classes, so there is no v2 counterpart to change.Testing
test_pipeline_session_request_keeps_training_job_name(test_model_trainer.py) andtest_pipeline_session_request_keeps_tuning_job_name(test_tuner.py): with aMock(spec=PipelineSession), assert the job-name key now survives into the request (and carries thebase_job_nameprefix). Both fail on master, pass with the fix.Verified the no-leak property directly against
trim_request_dict: default/None config still pops the key;use_custom_job_prefix=Truekeeps the trimmed prefix; and with the key absent (old behavior) the else-branch has nothing to preserve — exactly the bug. All 114 tests intest_model_trainer.py+test_tuner.pypass;black(100) /flake8(120) clean.Backwards compatibility
No public signature change. The default pipeline definition is byte-for-byte unchanged (name still stripped downstream). Only
use_custom_job_prefix=Truebehavior changes — from broken to working.