Proof of concept - Do not merge - Tests to decide labels field model #3283
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Description of the change(s) you made
Creates new fields in the ContentNode model to test which one fits better for our new labels
Create a test to check adding and filtering labels, and its descendants work
Create a test to measure performance when having many nodes in the table
Output when creating 1000 nodes
without indexes
with indexes
Output when creating 100,000 nodes
Without indexes
With indexes
Output when creating 10,000 nodes with indexes
Output when nodes are created using TreeBuilder
without indexes
with indexes
Reviewer guidance
These tests were run in a laptop with 16 GB of RAM and i7-8550U CPU @ 1.80GHz
It would be good to know if results in another hardware are too different
To run the massive test:
LABELS_MASSIVE=true pytest -s contentcuration/contentcuration/tests/test_labels.py::LabelsMassiveTestCase
The number of nodes to be created can be changed in line 92 of contentcuration/contentcuration/tests/test_labels.py
Are there any risky areas that deserve extra testing?
After looking at this PR a decission on the model field should be taken
References
#3263
Comments
Notice no indexes were applied in the new fields. After indexes are applied, inserting labels will take longer, but searching for them will take less time.
Contributor's Checklist
PR process:
CHANGELOG
label been added to this PR. Note: items with this label will be added to the CHANGELOG at a later timedocs
label has been added if this introduces a change that needs to be updated in the user docs?requirements.txt
files also included in this PRStudio-specifc:
notranslate
class been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)pages
,components
, andlayouts
directories as described in the docsTesting:
Reviewer's Checklist
This section is for reviewers to fill out.
yarn
andpip
)