Skip to content

Added handler for pipeline variable while creating process job #5122

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

Merged
merged 26 commits into from
Apr 10, 2025

Conversation

rsareddy0329
Copy link
Contributor

@rsareddy0329 rsareddy0329 commented Apr 8, 2025

Issue #, if available:
#3425
Description of changes:

  • Added handler for PipelineVariable to handle json serialization error in arguments before invoking create_process_job
    Testing done:
  • Added relevant unit tests to test the handler method added in this PR.
  • Also, built and tested the changes in personal account's jupyterlab space

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • I have read the CONTRIBUTING doc
  • I certify that the changes I am introducing will be backward compatible, and I have discussed concerns about this, if any, with the Python SDK team
  • I used the commit message format described in CONTRIBUTING
  • I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
  • I have updated any necessary documentation, including READMEs and API docs (if appropriate)

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
  • I have checked that my tests are not configured for a specific region or account (if appropriate)
  • I have used unique_name_from_base to create resource names in integ tests (if appropriate)
  • If adding any dependency in requirements.txt files, I have spell checked and ensured they exist in PyPi

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Roja Reddy Sareddy and others added 24 commits January 29, 2025 00:07
…aining script which can misguide users.Training script can be of latest version based on the support provided by framework_version of the container
@rsareddy0329 rsareddy0329 requested a review from a team as a code owner April 8, 2025 06:11
Comment on lines 512 to 513
def _normalize_pipeline_variable(self, value):
"""Helper function to normalize PipelineVariable objects"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does normalize mean in this case ?

Is this like a to_string ? We can probably rename this .

Comment on lines 515 to 526
if isinstance(value, Parameter):
return str(value.default_value) if value.default_value is not None else None

elif isinstance(value, ExecutionVariable):
return f"{value.name}"

elif isinstance(value, Join):
normalized_values = [
normalize_pipeline_variable(v) if isinstance(v, PipelineVariable) else str(v)
for v in value.values
]
return value.on.join(normalized_values)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this function is only called on value being PipelineVariable right ?
Why do we need the rest of the If conditions ?

Comment on lines 528 to 532
elif isinstance(value, PipelineVariable):
if hasattr(value, 'default_value'):
return str(value.default_value)
elif hasattr(value, 'expr'):
return str(value.expr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we instead overload the __str__ function within the class ?

@@ -499,6 +509,37 @@ def _normalize_outputs(self, outputs=None):
normalized_outputs.append(output)
return normalized_outputs

def _normalize_pipeline_variable(self, value):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add data types and return types

@nargokul nargokul merged commit 28e07cf into aws:master Apr 10, 2025
13 of 14 checks passed
rsareddy0329 pushed a commit to rsareddy0329/sagemaker-python-sdk that referenced this pull request Apr 14, 2025
rsareddy0329 added a commit that referenced this pull request Apr 15, 2025
* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* documentation: Removed a line about python version requirements of training script which can misguide users.Training script can be of latest version based on the support provided by framework_version of the container

* feature: Enabled update_endpoint through model_builder

* fix: fix unit test, black-check, pylint errors

* fix: fix black-check, pylint errors

* fix:Added handler for pipeline variable while creating process job

* fix: Added handler for pipeline variable while creating process job

* Revert the PR changes: #5122, due to issue https://t.corp.amazon.com/P223568185/overview

* Fix: fix the issue, https://t.corp.amazon.com/P223568185/communication

---------

Co-authored-by: Roja Reddy Sareddy <[email protected]>
rsareddy0329 added a commit that referenced this pull request Apr 20, 2025
* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* documentation: Removed a line about python version requirements of training script which can misguide users.Training script can be of latest version based on the support provided by framework_version of the container

* feature: Enabled update_endpoint through model_builder

* fix: fix unit test, black-check, pylint errors

* fix: fix black-check, pylint errors

* fix:Added handler for pipeline variable while creating process job

* fix: Added handler for pipeline variable while creating process job

* Revert the PR changes: #5122, due to issue https://t.corp.amazon.com/P223568185/overview

* Fix: fix the issue, https://t.corp.amazon.com/P223568185/communication

* Revert PR 5122 changes, due to issues with other processor codeflows

---------

Co-authored-by: Roja Reddy Sareddy <[email protected]>
Co-authored-by: Zhaoqi <[email protected]>
mollyheamazon pushed a commit that referenced this pull request Apr 21, 2025
* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* documentation: Removed a line about python version requirements of training script which can misguide users.Training script can be of latest version based on the support provided by framework_version of the container

* feature: Enabled update_endpoint through model_builder

* fix: fix unit test, black-check, pylint errors

* fix: fix black-check, pylint errors

* fix:Added handler for pipeline variable while creating process job

* fix: Added handler for pipeline variable while creating process job

---------

Co-authored-by: Roja Reddy Sareddy <[email protected]>
mollyheamazon pushed a commit that referenced this pull request Apr 21, 2025
* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* change: Allow telemetry only in supported regions

* documentation: Removed a line about python version requirements of training script which can misguide users.Training script can be of latest version based on the support provided by framework_version of the container

* feature: Enabled update_endpoint through model_builder

* fix: fix unit test, black-check, pylint errors

* fix: fix black-check, pylint errors

* fix:Added handler for pipeline variable while creating process job

* fix: Added handler for pipeline variable while creating process job

* Revert the PR changes: #5122, due to issue https://t.corp.amazon.com/P223568185/overview

* Fix: fix the issue, https://t.corp.amazon.com/P223568185/communication

---------

Co-authored-by: Roja Reddy Sareddy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants