-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(feature-processor): Add Lake Formation credential vending and Spark 3.5/Python 3.12 support #5816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BassemHalim
wants to merge
23
commits into
aws:master
Choose a base branch
from
BassemHalim:feat/feature-store-fp-lf
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(feature-processor): Add Lake Formation credential vending and Spark 3.5/Python 3.12 support #5816
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
ac5f7b7
feat(feature-processor): Add use_lake_formation_credentials parameter
BassemHalim 18cd319
feat(feature-processor): Add signing key for stored function integrity
BassemHalim 1aa4b3d
feat(feature-processor): Add Spark image resolver for dynamic image URI
BassemHalim 8796003
feat(feature-processor): Use image resolver and pass signing key in s…
BassemHalim 8d8847f
fix(feature-processor): Dynamic Hadoop version and always-on Feature …
BassemHalim 544fd94
feat(remote-function): Support Python 3.12 and auto-detect Spark version
BassemHalim 932c997
Add Integ test (WIP)
BassemHalim 6d7e7bf
Merge branch 'master' into feat/feature-store-fp-lf
BassemHalim 5eca24b
fix(sagemaker-core): Update Spark image error message to include Pyth…
BassemHalim 6a9e051
chore(sagemaker-mlops): Add pyspark 3.5.1 to test and feature-process…
BassemHalim eb1eaf8
test(sagemaker-mlops): Skip Spark integ tests on unsupported Python v…
BassemHalim 2df34bb
feat(sagemaker-mlops): Auto-install feature-store-pyspark in to_pipeline
BassemHalim 6f08b06
feat(sagemaker-mlops): Add Python 3.12 Spark support and auto-install…
BassemHalim 50c87f0
feat(feature-processor): Auto-install feature-store-pyspark for Spark…
BassemHalim 08a884f
test(feature-processor): Update test_to_pipeline to match injected pr…
BassemHalim f8479c5
Merge branch 'master' into feat/feature-store-fp-lf
BassemHalim 609c0e6
fix
BassemHalim 71de6cc
fix(feature-processor): Update JAR copy command to use glob pattern f…
BassemHalim a4b6fa5
test(feature-processor): Add unit tests for LF credentials, ECDSA key…
BassemHalim 9c2c22d
test(remote-function): Add test for pyspark version auto-detection in…
BassemHalim 0f0b190
Merge branch 'master' into feat/feature-store-fp-lf
mollyheamazon 5b4914c
fix(test): Mock pyspark in unit test and remove debug print
BassemHalim 589ae0a
fix(feature-processor): Move pyspark import to function scope in imag…
BassemHalim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
sagemaker-mlops/src/sagemaker/mlops/feature_store/feature_processor/_image_resolver.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"). You | ||
| # may not use this file except in compliance with the License. A copy of | ||
| # the License is located at | ||
| # | ||
| # http://aws.amazon.com/apache2.0/ | ||
| # | ||
| # or in the "license" file accompanying this file. This file is | ||
| # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF | ||
| # ANY KIND, either express or implied. See the License for the specific | ||
| # language governing permissions and limitations under the License. | ||
| """Resolves SageMaker Spark container image URIs based on installed PySpark and Python versions.""" | ||
| from __future__ import absolute_import | ||
|
|
||
| import sys | ||
|
|
||
| from sagemaker.core import image_uris | ||
|
|
||
| SPARK_IMAGE_SUPPORT_MATRIX = { | ||
| "3.1": ["py37"], | ||
| "3.2": ["py39"], | ||
| "3.3": ["py39"], | ||
| "3.5": ["py39", "py312"], | ||
| } | ||
|
|
||
|
|
||
| def _get_spark_image_uri(session): | ||
| """Resolve the SageMaker Spark container image URI for the installed PySpark and Python versions. | ||
|
|
||
| Args: | ||
| session: SageMaker Session with boto_region_name attribute. | ||
|
|
||
| Returns: | ||
| str: The ECR image URI for the matching Spark container. | ||
|
|
||
| Raises: | ||
| ValueError: If the Spark/Python version combination is not supported. | ||
| """ | ||
| import pyspark | ||
|
|
||
| spark_version = ".".join(pyspark.__version__.split(".")[:2]) | ||
| py_version = f"py{sys.version_info[0]}{sys.version_info[1]}" | ||
|
|
||
| supported_py = SPARK_IMAGE_SUPPORT_MATRIX.get(spark_version) | ||
| if supported_py is None: | ||
| supported = ", ".join(sorted(SPARK_IMAGE_SUPPORT_MATRIX.keys())) | ||
| raise ValueError( | ||
| f"No SageMaker Spark container image available for Spark {spark_version}. " | ||
| f"Supported versions for remote execution: {supported}." | ||
| ) | ||
|
|
||
| if py_version not in supported_py: | ||
| raise ValueError( | ||
| f"SageMaker Spark {spark_version} container images support " | ||
| f"{', '.join(supported_py)}. Current Python version: {py_version}." | ||
| ) | ||
|
|
||
| return image_uris.retrieve( | ||
| framework="spark", | ||
| region=session.boto_region_name, | ||
| version=spark_version, | ||
| py_version=py_version, | ||
| container_version="v1", | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is injected into pre_execution_commands for any Spark job, but the glob
*3.5*.jaris hardcoded to Spark 3.5. If a user has Spark 3.3 installed, this command will silently copy nothing (no matching JARs), and the Feature Store JAR won't be on the classpath. The dynamic version detection done in_spark_factory.py (spark_version = ".\".join(pyspark.__version__.split(".")[:2]))should be used here too — but since this runs at_JobSettings.__init__ time (client side),pyspark.__version__is available. The glob should use the detected version, not a hardcoded 3.5.