Make blockstore an installable package [SE-4987] - #140
Conversation
|
Thanks for the pull request, @jvdm! I've created OSPR-6227 to keep track of it in JIRA, where we prioritize reviews. Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
|
Thanks for the PR @jvdm @jristau1984 - I'll leave a review this week. |
| classifiers=[ | ||
| 'Development Status :: 3 - Alpha', | ||
| 'Framework :: Django', | ||
| 'Framework :: Django :: 2.2', |
There was a problem hiding this comment.
Shouldn't this be Django 3.2?
|
|
||
| Imported here to allow consumers to import the public api from `blockstore.api`. | ||
| """ | ||
| from blockstore.apps.api import * # pylint: disable=wildcard-import |
There was a problem hiding this comment.
Is this necessary to do? These API calls return models that echo models that are in blockstore itself. Also, it's inconsistent with more recent practice in OEP-49 to create a separate set of attrs data structures to pass back in these situations.
I realize this is an intermediate state, and I imagine a lot of the models brought over from edx-platform's client-side code. My main concern is that we'd be introducing an api module with some implied level of stability, and then possibly changing all of it.
Is the plan for what happens to the API redundancies written down somewhere? I'm fine with this as an intermediate state, but I'd like to understand where we're going with collapsing these down?
There was a problem hiding this comment.
I agree that eventually we should only have one set of attrs. However, the problem is that there are differences between the two sets of attrs. The easiest way to allow fast rollbacks and to keep the changes easy to understand was to keep them all in the methods.api file. If we try to collapse them now, it would require making changes to callers in various places in edx-platform and make rollbacks harder. This way ensures that from the point of view of callers, the API hasn't changed. And once blockstore is an in-process app, we can incrementally update the APIs and their callers.
My main concern is that we'd be introducing an api module with some implied level of stability, and then possibly changing all of it.
Agree with this. @jvdm We should remove this file for now and only add methods later that we want to mark stable.
Is the plan for what happens to the API redundancies written down somewhere? I'm fine with this as an intermediate state, but I'd like to understand where we're going with collapsing these down?
Nope, not yet. I was thinking we would look at the usages in edx-platform and then see how the APIs should be updated for better performance and ergonomics – the system boundary has changed and there may be opportunities for these?
There was a problem hiding this comment.
@jvdm We should remove this file for now and only add methods later that we want to mark stable.
+1
There was a problem hiding this comment.
I was thinking we would look at the usages in edx-platform and then see how the APIs should be updated for better performance and ergonomics – the system boundary has changed and there may be opportunities for these?
Sounds good.
|
@jvdm Can you please keep the original commits? They are different changes and have separate commit messages so keeping them separate is important. |
Hmm, I left a comment somewhere but am unable to find it now. Basically I had updated the label of the bundles app to namespace it but forgot it would cause the models to assume a different table name (and none of the reviewers caught that because everyone was testing with a fresh db). 🙂 |
4f209b6 to
6499097
Compare
|
@ormsbee Leaving a ping here, we have updated the PR with the requested changes you left. Let us know if you would like to follow up on anything else. Thank you. |
There was a problem hiding this comment.
Thanks @jvdm. I'm approving the changes with two minor caveats:
- Please change the commit message to include more of the context from the PR message.
- I don't think I have the access to deploy this any longer, so I'm tagging @kenclary and @connorhaugh on that front.
Also, in the future, please don't squash the commits until the review is finished. It just makes it easier to see what's changed since the last review round. Thank you.
- Move apps/api to apps/rest_api. - Copy the latest code in edx-platform/openedx/core/lib/blockstore_api to blockstore/apps/api. This has been done to make the review of Blockstore as App [SE-3321] Blockstore as App [SE-3321] openedx-unsupported#97 easier since we will get a useful diff of changes made to each of the API methods. - Makes the apps into an installable package. - It also disables the migration code which changes the MySQL character set to utfmb4 to prevent accidentally running it against an edxapp database. Co-authored-by: Usman Khalid <2200617@gmail.com>
6499097 to
3f4d979
Compare
Done.
Cool, thanks. |
|
@jvdm 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
|
This seems to have deployed with no noticeable errors. |
Steps 2-4 mentioned in https://tasks.opencraft.com/browse/EDXCL-4 🙂 |
|
Thanks @symbolist , I think that ticket requires a tasks.opencraft.com account -- would I be able to get an account? |
|
Steps 2-4 from the ticket above copied here for reference: 2 - Replace calls to Blockstore from edx-platform to the Python API from the new, migrated, blockstore package. 3 - There are a few tests which are integration tests but need to become unit tests (since blockstore is going to be an installed app). These need to be verified and any fixes made. 4 - There is a bug related to how the media urls for files in bundles are passed around in the devstack that needs to be resolved. |
|
Thanks @jristau1984 ! It seems like EDXCL-4's Step 2 corresponds to Step 2 from the TNL migration plan, which is great. Heads up that the TNL plan asks for Step 2 to be done behind a feature flag, and that it requires Step 1 from the TNL plan (giving edxapp access to the blockstore DB) to be done first. |
Description
This is a follow-up PR built on top of @symbolist's #135. It's still part of #97, and is a step towards its completion.
The previous description holds, and is copied verbatim here for reference:
Author Comments, Concerns, and Open Questions
Co-authored-by: Usman Khalid 2200617@gmail.com
Test Instructions
In your devstack:
Go to your
devstack, enable frontend-app-library-authoring, put everything up.Drop any potential blockstore tables, see:
Provision blockstore by following its README steps. This should create the tables from
master.Run tests with
make test.Go to
localhost:3001, create a library.Create any block inside the library.
Got to
blockstoreand stop blockstore development service.Checkout the development branch
jvdm/packagify-blockstore.Provision
blockstoreone more time.Open
localhost:3001and verify the library and block opens successfully.Add
blockstore.apps.bundles.apps.BundlesConfig, tolms/envs/common.py::INSTALLED_APPS.Install the package in LMS:
Open the django shell
python manage.py lms shelland check the API methodscan be called: