-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Add Django Settings to roll out extracted XBlocks #35308
Comments
@kdmccormick thanks for brainstorming the solution, it seems interesting to me, some points:
|
|
Is the idea here that there is safety from data races because the waffle flag is loaded in the same transaction as the xblock DB accesses? (Are there any caches we need to worry about?) |
Nope, I hadn't thought about data races until you mentioned them. I don't think we need to worry about them, since the data model and data access patterns should be unchanged between the built-in and extracted block implementations. Same with the caches-- if we have done our work right, it will just be a different class accessing the same caches in the same exact way. |
FYI @farhan @robrap -- I had originally said that we need CourseWaffleFlags so that individual course runs could switch back and forth between the blocks. I was wrong about that: the set-up I describe would globally toggle between the extracted block and the builtin block, so we should just use regular WaffleFlags. Toggling between block classes per course run would be significantly more complex to implement and, in my opinion, would introduce operational risks in itself. Standard WaffleFlags would still permit operators to use user-by-user rollout or percentage-based rollout, so I think they are sufficient. |
@kdmccormick: That makes sense. Agreed that percent roll-out is what is most important. Could you also add one (or more) custom attributes that would be useful for a dashboard to show which is being used? See openedx/edx-django-utils#328. |
@robrap as we discussed, I've added a note for the team to set a custom attribute. The key will be |
Instead of a special value like None, I think the attribute name (or key) should not be added if not needed. Does that makes sense? |
FYI: @nsprenkle: Regarding our overridden XBlocks. |
|
Thanks @kdmccormick.
I hadn't realized you had an implementation and that the former was simpler. For monitoring, really anything that works is fine. Feel free to do whichever, and I can verify that it works as planned (e.g. we can easily tell the difference between the 3 cases, or by default, at least 2 of the cases). |
@robrap We've had to adjust the acceptance criteria here a bit. Rather than using Waffle flags, we'll be using Django settings. The reason for the change is that Waffle flags require Model access, which Django does not make available until after all INSTALLED_APPS are loaded; but, loading INSTALLED_APPS causes the xmodule/ modules to be imported, which invoked the Waffle flags, thus creating a circular dependency. Django settings, on the other hand, do not have this limitation; they are available to use very early in the Django initialization process. |
From earlier:
Last message:
Although this may be for good reasons, I'm simply clarifying the consequence that user-by-user or percentage-based rollout will no longer be available, and this will now be an all-or-nothing configuration (presumably per block?). That said - I stepped into this conversation: 1) to provide some monitoring tips, and 2) because I'm a busybody that gets myself involved in other people's business. :) I'm going to drop from this ticket, in favor of someone at 2U who owns this. I will make sure someone is aware of this. Thank you @kdmccormick. (Of course if there are questions that require my specific expertise, please feel free to ping me.) |
Yes, exactly right. |
Final inform: TNL is generally tracking this and not seeing any issues. Thanks again @kdmccormick, and good luck. |
Once a block in https://github.com/openedx/xblocks-contrib is ready, we will need to safely roll it out in edx-platform. To do that safely, we need to be able to toggle between the old and new block quickly without putting course content or user state at risk. Unfortunately, I do not think we could easily toggle between blocks in setup.py.
However, what we can do (without touching setup.py at all) is define a Django setting for each block, which toggles between the built-in class and the extracted class. Let's use the WordCloud block as an example:
Define a stub WordCloudBlock class in xblocks-contrib.
is_extracted = True
. More on this later.In
lms/envs/common.py
:In the builtin XBlock definition module, for example
xmodule/word_cloud_block.py
:class WordCloudBlock
toclass _BuiltInWordCloudBlock
_BuiltInWordCloudBlock
, add a new constant class attribute:is_extracted = False
. More on this later.Do this for all component XBlocks:
Lastly, make use of the
is_extracted
class attribute you added earlier by adding a custom monitoring attribute to the render_xblock view, which will show up in site operator's monitoring systems and allow them to isolate any errors and warnings which come from extracted blocks:Once all of that is merged, we can toggle between each builtin block and its extracted counterpart in development. Also, edX.org can toggle it in production when they are ready, giving them the ability to test this ahead of time.
Only once an extracted block is proven to be stable, we can truly replace its built-in block:
The text was updated successfully, but these errors were encountered: