Repository navigation
feat: include training_plan_arn in remote function classes (#5157) - #6353
mohamedzeidan2021 wants to merge 2 commits into
Conversation
|
Claude finished @mohamedzeidan2021's task in 55s —— View job Code Review —
|
|
Claude finished @mohamedzeidan2021's task in 44s —— View job Code Review —
|
lucasjia-aws
left a comment
There was a problem hiding this comment.
Automated review: 1 non-blocking suggestion. See inline comment.
| use_torchrun: bool = False, | ||
| use_mpirun: bool = False, | ||
| nproc_per_node: Optional[int] = None, | ||
| training_plan_arn: str = None, |
There was a problem hiding this comment.
[suggestion] typing
The annotation str contradicts the None default — a type checker reads training_plan_arn: str = None as an invalid default. The adjacent optional parameter uses Optional[int] = None; match that here so the annotation is honest about accepting None.
training_plan_arn: Optional[str] = None,Same pattern at client.py:567 (RemoteExecutor.__init__) and job.py:422 (_JobSettings.__init__).
Problem
The remote function interfaces (
@remotedecorator,RemoteExecutor, and the underlying_JobSettings) did not exposetraining_plan_arn, so remote-function training jobs could not target reserved-capacity training plans.ResourceConfig.TrainingPlanArnis a valid member ofCreateTrainingJobin botocore (no service dependency), but there was no way to set it.Fix
Added an optional
training_plan_arn: str = Noneparameter to@remote,RemoteExecutor.__init__, and_JobSettings.__init__(sagemaker-core). It is forwarded into_JobSettingsfrom both public entry points, stored on the settings, and — when set — added to the compiledResourceConfigasTrainingPlanArnusing the sameis not Noneguard as the adjacent optional fields. The parameter defaults toNone, so behavior is byte-for-byte unchanged when omitted. Docstrings added in all three locations. (The sagemaker-trainremote_functionmodules are deprecation shims that re-export from core, so they inherit the change automatically.)Testing
test_compile_with_training_plan_arn/test_compile_without_training_plan_arn:TrainingPlanArnpresent inResourceConfigwhen set, absent whenNone.test_init_stores_training_plan_arn/test_init_training_plan_arn_defaults_to_none: real_JobSettingsstores the value / defaults toNone.test_remote_decorator_forwards_training_plan_arn/test_remote_executor_forwards_training_plan_arn: both public entry points forward the kwarg into_JobSettings.remote_functionunit suite: 236 passed, no regressions.black+flake8clean.Fixes #5157