Skip to content

feature: Add Extra Parameters to Lambda Function Wrapper #3594

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 11 commits into from
Apr 27, 2023

Conversation

dipanjank
Copy link
Contributor

@dipanjank dipanjank commented Jan 17, 2023

*Issue #3563

Description of changes:

  • Add VpcConfig, Architectures, Environment and Layers parameters for boto3 Lambda create_function call.
  • Add Architectures for boto3 Lambda update_function call.

Testing done:

pytest -vs tests/unit/test_lambda_helper.py
================================================================================================= test session starts ==================================================================================================
platform darwin -- Python 3.7.11, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /Users/[email protected]/PycharmProjects/sagemaker-python-sdk-personal/venv/bin/python3
cachedir: .pytest_cache
rootdir: /Users/[email protected]/PycharmProjects/sagemaker-python-sdk-personal, configfile: tox.ini
plugins: forked-1.4.0, timeout-2.1.0, rerunfailures-10.2, xdist-2.4.0, anyio-3.6.2, cov-3.0.0
collected 28 items                                                                                                                                                                                                     

tests/unit/test_lambda_helper.py::test_lambda_object_with_arn_happycase PASSED
tests/unit/test_lambda_helper.py::test_lambda_object_with_name_happycase1 PASSED
tests/unit/test_lambda_helper.py::test_lambda_object_with_name_happycase2 PASSED
tests/unit/test_lambda_helper.py::test_lambda_object_with_no_name_and_arn_error PASSED
tests/unit/test_lambda_helper.py::test_lambda_object_no_code_error PASSED
tests/unit/test_lambda_helper.py::test_lambda_object_both_script_and_code_dir_error_with_name PASSED
tests/unit/test_lambda_helper.py::test_lambda_object_both_script_and_code_dir_error_with_arn PASSED
tests/unit/test_lambda_helper.py::test_lambda_object_no_handler_error PASSED
tests/unit/test_lambda_helper.py::test_lambda_object_no_execution_role_error PASSED
tests/unit/test_lambda_helper.py::test_create_lambda_happycase1 PASSED
tests/unit/test_lambda_helper.py::test_create_lambda_happycase2 PASSED
tests/unit/test_lambda_helper.py::test_create_lambda_happycase3 PASSED
tests/unit/test_lambda_helper.py::test_create_lambda_no_function_name_error PASSED
tests/unit/test_lambda_helper.py::test_create_lambda_client_error PASSED
tests/unit/test_lambda_helper.py::test_update_lambda_happycase1 PASSED
tests/unit/test_lambda_helper.py::test_update_lambda_happycase2 PASSED
tests/unit/test_lambda_helper.py::test_update_lambda_happycase3 PASSED
tests/unit/test_lambda_helper.py::test_update_lambda_s3bucket_not_provided PASSED
tests/unit/test_lambda_helper.py::test_update_lambda_client_error PASSED
tests/unit/test_lambda_helper.py::test_upsert_lambda_happycase1 PASSED
tests/unit/test_lambda_helper.py::test_upsert_lambda_happycase2 PASSED
tests/unit/test_lambda_helper.py::test_upsert_lambda_client_error PASSED
tests/unit/test_lambda_helper.py::test_invoke_lambda_happycase PASSED
tests/unit/test_lambda_helper.py::test_invoke_lambda_client_error PASSED
tests/unit/test_lambda_helper.py::test_delete_lambda_happycase PASSED
tests/unit/test_lambda_helper.py::test_delete_lambda_client_error PASSED
tests/unit/test_lambda_helper.py::test_upload_to_s3 PASSED
tests/unit/test_lambda_helper.py::test_zip_lambda_code PASSED

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)

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

@dipanjank dipanjank requested a review from a team as a code owner January 17, 2023 09:33
@dipanjank dipanjank requested review from knikure and removed request for a team January 17, 2023 09:33
@dipanjank dipanjank changed the title Add Extra Parameters to Lambda Function Wrapper feature: Add Extra Parameters to Lambda Function Wrapper Jan 17, 2023
@jpcpereira
Copy link

Hi @dipanjank , nice PR, would be really great if you could include "Layers" to the additional inputs to create the Lambda function. This is also one of the options in Boto3. Would enable setting AWS Lambda Layers with extra useful libraries without having to zip & pass them.

@dipanjank
Copy link
Contributor Author

Hi @dipanjank , nice PR, would be really great if you could include "Layers" to the additional inputs to create the Lambda function. This is also one of the options in Boto3. Would enable setting AWS Lambda Layers with extra useful libraries without having to zip & pass them.

Thanks for the review! sure.

Copy link
Contributor

@knikure knikure left a comment

Choose a reason for hiding this comment

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

/bot run all

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: 6f13f15
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-local-mode-tests
  • Commit ID: 6f13f15
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-notebook-tests
  • Commit ID: 6f13f15
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: 6f13f15
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 6f13f15
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@knikure knikure left a comment

Choose a reason for hiding this comment

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

@dipanjank Can you resolve the conflicts in your branch and rebase it over master?

@dipanjank
Copy link
Contributor Author

@knikure sure, will do!

@dipanjank
Copy link
Contributor Author

/bot run all

@dipanjank
Copy link
Contributor Author

Hi @knikure updated with latest from master + added the "layer" argument requested by @jpcpereira. Can you please review again?

@dipanjank dipanjank requested a review from knikure February 26, 2023 10:11
Copy link
Contributor

@knikure knikure left a comment

Choose a reason for hiding this comment

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

/bot run all

Copy link
Contributor

@knikure knikure left a comment

Choose a reason for hiding this comment

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

/bot run all

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: a7d442d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: a7d442d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-local-mode-tests
  • Commit ID: a7d442d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-notebook-tests
  • Commit ID: a7d442d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: a7d442d
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2023

Codecov Report

Merging #3594 (7fb9f48) into master (0473a8e) will decrease coverage by 0.76%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3594      +/-   ##
==========================================
- Coverage   90.21%   89.45%   -0.76%     
==========================================
  Files         996      233     -763     
  Lines       94508    23383   -71125     
==========================================
- Hits        85257    20918   -64339     
+ Misses       9251     2465    -6786     
Impacted Files Coverage Δ
src/sagemaker/lambda_helper.py 95.93% <100.00%> (ø)

... and 1228 files with indirect coverage changes

Copy link
Contributor

@knikure knikure left a comment

Choose a reason for hiding this comment

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

/bot run all

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-local-mode-tests
  • Commit ID: 7f1b945
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: 7f1b945
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: 7f1b945
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-notebook-tests
  • Commit ID: 7f1b945
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 7f1b945
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@dipanjank
Copy link
Contributor Author

Hi @knikure is there anything further I need to do to get this PR merged?

Copy link
Contributor

@knikure knikure left a comment

Choose a reason for hiding this comment

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

/bot run all

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-local-mode-tests
  • Commit ID: 7fb9f48
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-notebook-tests
  • Commit ID: 7fb9f48
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-unit-tests
  • Commit ID: 7fb9f48
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-slow-tests
  • Commit ID: 7fb9f48
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-python-sdk-pr
  • Commit ID: 7fb9f48
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@knikure knikure merged commit 239fc9d into aws:master Apr 27, 2023
@dipanjank dipanjank deleted the feature-3563-add-lambda-func-parameters branch April 28, 2023 08:53
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.

Lambda boto3 wrappers doesn't have all the option that we need to create a lambda
6 participants