Repository navigation
FrameworkProcessor source_dir wrong behavior #5735
Description
PySDK Version
- PySDK V2 (2.x)
- PySDK V3 (3.x)
Describe the bug
It used to be possible to create a pipeline step with FrameworkProcessor, providing a source_dir (archive in S3 containing entrypoint Python file as well as other dependencies/code) and code (the name of the entrypoint Python file). The source_dir S3 uri would then get mapped into /opt/ml/processing/input/code/, and a runproc.sh script would be created and uploaded, which would then serve as the ProcessingJob' entrypoint (install requirements if present, and run the Python file inside /opt/ml/processing/input/code/).
This is currently not possible anymore. It should be possible to use an S3 uri for source_dir, but it isn't. The code in _package_code only makes sense when source_dir is a local directory which is then uploaded. We require the previous behavior to be available as well, in order to fully migrate from v2 to v3.
To reproduce
Define a FrameworkProcessor and pass an S3 uri to source_dir:
script_evaluation = FrameworkProcessor(
image_uri=self.image_uris["train"],
command=["python3"],
instance_type=self.instances["processing_type"],
instance_count=self.instances["processing_count"],
base_job_name=base_job_name,
output_kms_key=self.aws_params["kms_key_hub"],
volume_kms_key=self.aws_params["kms_key"],
network_config=self.network_config,
env={
"RANDOM_STATE": self.pipeline_params["RandomState"].to_string(),
**self.default_env_vars,
},
role=self.aws_params["exec_role"],
sagemaker_session=self.pipeline_session,
tags=self.tags,
)
step_evaluation_args = script_evaluation.run(
code="evaluate.py", <--- This is the Python entrypoint, but the evaluate.py file imports from other Python files within the source_dir
source_dir=self.s3_uri_sourcedir, # <--- This is an S3 uri and causes problems
# add inputs and outputs as needed
arguments=None,
)
Expected behavior
The same behavior as in v2: source_dir should be mapped into /opt/ml/processing/input/code/, a runproc.sh entrypoint should be created and uplodaded that runs the Python file defined in code (which is part of source_dir). source_dir should not be looked for locally, packaged and uploaded, if source_dir is already an S3 uri.
System information
A description of your system. Please provide:
- SageMaker Python SDK version: 3.7.1
Additional context
This is a roadblock for my company for the migration from v2 to v3.
Activity
maxiuboldi commentedon May 28, 2026
I have the same problem, is there any workaround?
d-vesely commentedon Jun 1, 2026
@maxiuboldi there might be some workarounds for certain situations, but no easy ones that would be acceptable for me and my team.
maxiuboldi commentedon Jun 2, 2026
@d-vesely Hi! I understand, thanks for replying. My team is in the same boat; we have some workarounds, but none of them are sustainable. We've paused the migration until it's properly resolved.
d-vesely commentedon Jun 2, 2026
@maxiuboldi same here, we have also paused the migration. I hope the SageMaker team will resolve this quickly, it's been almost two months though.
d-vesely commentedon Jun 30, 2026
@maxiuboldi Any developments on your end regarding a workaround?
maxiuboldi commentedon Jun 30, 2026
Hi. @d-vesely! Not really. We looked at some options with our AWS architect, but none of them fit our use cases and company requirements. The architect confirmed that the issue is a regression. I'll ask if I can share some of the options he gave us; perhaps they'll be useful for you.
maxiuboldi commentedon Jun 30, 2026
@d-vesely, Hernan Antolini, our AWS architect, says you can email him at
hantoli@amazon.comto coordinate with him. I hope you have better luck than we did 🤞🏻.maxiuboldi commentedon Jul 20, 2026
Hi @d-vesely! We submitted a ticket about this issue at our company and it seems they'll be releasing the fix soon. #6047 🤞🏻.
d-vesely commentedon Aug 3, 2026
@maxiuboldi Cool, thank you very much for being proactive. Going to look into the changes this week, if all works well I can finally close this issue!