Skip to content
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

Remove boto, upgrade boto3 & botocore #31175

Closed
13 tasks done
Tracked by #32888
jmbowman opened this issue Oct 19, 2022 · 12 comments
Closed
13 tasks done
Tracked by #32888

Remove boto, upgrade boto3 & botocore #31175

jmbowman opened this issue Oct 19, 2022 · 12 comments
Assignees

Comments

@jmbowman
Copy link
Contributor

jmbowman commented Oct 19, 2022

edx-platform is still using versions of boto, boto3, and botocore that were originally pinned (by me) 4.5 years ago before the repo even had a constraints.txt file. boto isn't even supported anymore, and I recently stumbled into a performance problem that might just be fixed automatically by an upgrade. Please get us to reasonably current versions. Suggested sequence:

  1. Move the constraints to constraints.txt so we actually notice they exist
  2. Do any work needed to remove the dependency on boto
  3. Start upgrading botocore and boto3 in parallel; try to go just far enough to upgrade to one potentially breaking change each time.

Finding the breaking changes may be difficult, as the boto3 and botocore changelogs are almost useless lists of daily API change notifications, and we don't really use boto3 in CI. But it looks like particular care may be needed for the upgrade to 1.9.0: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/upgrading.html . And I suspect we don't use the vast majority of services covered in the changelog, so we may be ok just looking for changes related to s3 and maybe 1-2 other AWS services. Writing a doc on how to decide if it's safe to upgrade to a given boto3 or botocore release is probably a good idea, if you figure that out from this task.

@jmbowman jmbowman moved this to Todo in Arbi-BOM Oct 19, 2022
@iamsobanjaved iamsobanjaved moved this from Todo to In Progress in Arbi-BOM Nov 11, 2022
@iamsobanjaved iamsobanjaved moved this from In Progress to In Code Review in Arbi-BOM Jan 18, 2023
@UsamaSadiq UsamaSadiq moved this from Author Team Review to Owner Review in Arbi-BOM Feb 2, 2023
@jmbowman jmbowman moved this from 2022 Q4 to 2023 Q1 in Platform-Core Roadmap Feb 6, 2023
@awais786
Copy link
Contributor

awais786 commented Feb 14, 2023

edxapp is using django-storage = 1.8

The legacy S3BotoStorage backend was removed in version 1.9. This is the PR where it removed jschneier/django-storages#825

We can move from s3boto to s3boto3 using exiting django-storage = 1.8.
One of the main thing is handling exceptions.

s3boto is using these exception = https://github.com/boto/boto/blob/2.39.0/boto/exception.pys
3boto3 using these  exception =  https://github.com/boto/botocore/blob/1.8.17/botocore/exceptions.py

Plan:

  1. We will add both exceptions simultaneously. Then replace all codes occurrences
    from storages.backends.s3boto import S3BotoStorage with from storages.backends.s3boto3 import S3Boto3Storage and update the exceptions also and handle both boto and botocore exceptions. ( merge and deploy this )
  2. Next step is create PR in internal and deploy it.
  3. Remove all boto usages and exception and deploy it.
  4. If every thing goes as per plan we can upgrade django-storage to 1.9 as per documentation.

@iamsobanjaved
Copy link
Contributor

iamsobanjaved commented Feb 14, 2023

There are multiple (6+) pipelines to upgrade from the boto-based backend to the boto3-based backend. We can try to upgrade pipelines in an incremental approach, try merging 2 pipelines at once so we can verify with ease on stage before pushing our changes to prod.

@iamsobanjaved iamsobanjaved moved this from Owner Review to In Progress in Arbi-BOM Mar 8, 2023
@iamsobanjaved iamsobanjaved moved this from In Progress to Author Team Review in Arbi-BOM Mar 22, 2023
@iamsobanjaved iamsobanjaved moved this from Author Team Review to Owner Review in Arbi-BOM Mar 29, 2023
@awais786
Copy link
Contributor

awais786 commented Jun 6, 2023

We have successfully upgraded the django-storages to 1.9.1. Now only videos module left with boto import.

For further upgrade to 1.10.1 https://github.com/jschneier/django-storages/blob/master/CHANGELOG.rst#1101-2020-09-13
we need to change few settings variables and also sets the boto3 warning.

@awais786
Copy link
Contributor

awais786 commented Jun 7, 2023

No usage found

  • Course discovery
  • Credentials
  • Registrar
  • ecommerce
  • edx-enterprise

@UsamaSadiq
Copy link
Member

UsamaSadiq commented Jun 7, 2023

Usage found in

These following three repos are interlinked and using python2.7. So not possible to update with boto3.

@awais786
Copy link
Contributor

awais786 commented Jun 7, 2023

@jmbowman so far found usage here. I have created issues in these repos except luigi.

@jmbowman
Copy link
Contributor Author

jmbowman commented Jun 7, 2023

There's a "boto usage" filter view in the Repo Health Dashboard spreadsheet that shows just repos with "boto==" in the dependencies.pypi_all.listfield; it currently includes 22 repos. Some of them bring it in due to pinning to a stale version of moto, such as https://github.com/edx/video-encode-manager/blob/master/requirements/constraints.txt#L7-L8 .

Also, there seems to be a bug in the implementation of the requires.boto check. It's meant to be an easier way to find these repos, but it incorrectly has False for most of them.

@awais786
Copy link
Contributor

awais786 commented Jun 7, 2023

Lots of entries are coming from xblock-sdk. I have already fixed that just need to merge and release version.

@awais786
Copy link
Contributor

awais786 commented Jun 8, 2023

https://github.com/openedx/openedxstats/pull/209/files PR created for openedxstats
openedx-unsupported/openedxstats#211 using moto for tests.

@jmbowman jmbowman moved this from 2023 Q1 to 2023 Q3 in Platform-Core Roadmap Jul 27, 2023
@awais786
Copy link
Contributor

We have successfully upgraded the django-storages to 1.10.1. Now next target is 1.11.1

@awais786
Copy link
Contributor

awais786 commented Oct 5, 2023

django-storages upgrade to latest version in edx-platform. I think we can close this PR now. Boto still in use in videos module. I have already informed owning team.
They have following ticket https://2u-internal.atlassian.net/browse/TNL-10698

@awais786 awais786 closed this as completed Oct 5, 2023
@github-project-automation github-project-automation bot moved this from Owner Review to Done in Arbi-BOM Oct 5, 2023
@jristau1984 jristau1984 moved this from Done to Done - Long Term Storage in Arbi-BOM Sep 30, 2024
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

No branches or pull requests

5 participants