Skip to content
This repository was archived by the owner on Nov 20, 2025. It is now read-only.

Conversation

@humanzz
Copy link
Contributor

@humanzz humanzz commented Jul 10, 2023

Issue #, if available: #85

Description of changes:

  • add a dependency on boto3 for calling codeartifact apis
  • update model_server to check for the presence of codeartifact (CA_* prefixed) environment variable
  • if env variable is present, build the authenticated endpoint index url, and add that to the pip install command

Testing done:

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 used the commit message format described in CONTRIBUTING
  • I have used the regional endpoint when creating S3 and/or STS clients (if appropriate)
  • I have updated any necessary documentation, including READMEs

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

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

@humanzz
Copy link
Contributor Author

humanzz commented Jul 10, 2023

I've been using the codeartifact-related code for a few months already. I was not able to add any related integration tests as such tests would require access to a fixed codeartifact repo, and for the container to have access to AWS credentials.

I'm asking for guidance if any such integ tests would be needed here.

Additionally, is anything required in README to mention this CodeArtifact support?

@humanzz
Copy link
Contributor Author

humanzz commented Jul 15, 2023

I did some testing by modifying test/container/dummy/Dockerfile to

+COPY dummy/requirements.txt /opt/ml/models/code/requirements.txt
+
 ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"]
 CMD ["serve"]

where requirements.txt is a copy of https://github.com/aws/sagemaker-training-toolkit/blob/master/test/container/dummy/requirements.txt

I then went ahead and started the container - once without setting the CA_* env variables and once with

Without (i.e. public pypi index)
docker run -p 8080:8080 sagemaker-inference-toolkit-test:dummy serve

Collecting pyfiglet==0.8.post1 (from -r /opt/ml/models/code/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/33/07/fcfdd7a2872f5b348953de35acce1544dab0c1e8368dca54279b1cde5c15/pyfiglet-0.8.post1-py2.py3-none-any.whl (865kB)
Installing collected packages: pyfiglet
Successfully installed pyfiglet-0.8.post1
You are using pip version 19.0.3, however version 21.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Warning: MMS is using non-default JVM parameters: -XX:-UseContainerSupport
2023-07-15T22:48:58,867 [INFO ] main com.amazonaws.ml.mms.ModelServer -
...

With (i.e. from CodeArtifact index)
docker run -p 8080:8080 -e "CA_REPOSITORY_ARN=xxx" sagemaker-inference-toolkit-test:dummy serve

/usr/local/lib/python3.6/site-packages/boto3/compat.py:88: PythonDeprecationWarning: Boto3 will no longer support Python 3.6 starting May 30, 2022. To continue receiving service updates, bug fixes, and security updates please upgrade to Python 3.7 or later. More information can be found here: https://aws.amazon.com/blogs/developer/python-support-policy-updates-for-aws-sdks-and-tools/
  warnings.warn(warning, PythonDeprecationWarning)
Looking in indexes: https://***:****@xxx-xxx.d.codeartifact.xxx.amazonaws.com/pypi/xxx/simple/
Collecting pyfiglet==0.8.post1 (from -r /opt/ml/models/code/requirements.txt (line 1))
  Downloading https://xxx-xxx.d.codeartifact.xxx.amazonaws.com/pypi/xxx/simple/pyfiglet/0.8.post1/pyfiglet-0.8.post1-py2.py3-none-any.whl (865kB)
Installing collected packages: pyfiglet
Successfully installed pyfiglet-0.8.post1
You are using pip version 19.0.3, however version 21.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Warning: MMS is using non-default JVM parameters: -XX:-UseContainerSupport
2023-07-15T23:01:39,867 [INFO ] main com.amazonaws.ml.mms.ModelServer -
...

@chen3933
Copy link

I think it makes more sense to add a new feature which allow user to run plugin module at model server start time than add more specialized function here.

@humanzz humanzz force-pushed the codeartifact branch 2 times, most recently from 506fce7 to b0ca7e3 Compare July 19, 2023 12:22
chen3933
chen3933 previously approved these changes Jul 19, 2023
@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-inference-toolkit-pr
  • Commit ID: b0ca7e3
  • 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-inference-toolkit-pr
  • Commit ID: 77d6544
  • Result: FAILED
  • Build Logs (available for 30 days)

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

- add a dependency on boto3 for calling codeartifact apis
- update model_server to check for the presence of codeartifact (CA_* prefixed) environment variable
- if env variable is present, build the authenticated endpoint index url, and add that to the pip install command, otherwise keep using pypi index

closes aws#85
@sagemaker-bot
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: sagemaker-inference-toolkit-pr
  • Commit ID: aef258c
  • 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-inference-toolkit-pr
  • Commit ID: aef258c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants