-
-
Notifications
You must be signed in to change notification settings - Fork 747
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
Optimize storage (serialization and de-serilization) of very large dictionaries inside MongoDB #4846
Merged
Merged
Optimize storage (serialization and de-serilization) of very large dictionaries inside MongoDB #4846
Changes from 4 commits
Commits
Show all changes
107 commits
Select commit
Hold shift + click to select a range
a93f9c2
Add new JSONDictField which allows us to more efficently store,
Kami a89d658
Add new JSONDictField which allows us to more efficently store,
Kami fe5e33d
Add a feature flag for using new json dict field, set it to false
Kami f0919c9
Use new JSON dict field for dictionaries which can be very large where
Kami 59e87f9
Fix JSONDictEscapedFieldCompatibilityField to get it to work
m4dcoder 2024a1e
Merge branch 'master' into optimize_escaped_dict_fields
Kami 2f969f8
Add a micro-benchmark which comparsed execution save + read times for
Kami 5971302
Add another micro benchmark fixture which represents a dictionary with a
Kami f19f0fd
Add micro-benchmark for escape_chars() and unescape_chars() and update
Kami 81672f2
Add unit tests for the new fields.
Kami 2a15e8b
Merge branch 'optimize_escaped_dict_fields' of github.com:StackStorm/…
Kami 44bdbad
Handle subclass hack in the micro benchmark itself.
Kami 052fde7
Add some more tests.
Kami dbc5f3d
Fix invalid / broken test - result is a dict field and not a string.
Kami 424f3d7
Update more affected code to make sure we correctly handle new result
Kami ff485ca
Also benchmark JSONDict fields with compression.
Kami 6b1abf0
Update docstring.
Kami 89617ff
Add new "finalized_timestamp" field to the Execution and LiveAction
Kami fa03d2f
Add changelog entry.
Kami 68feb47
Update more affected and broken tests to correctly specify a dict value
Kami 4cb7a1d
Fow now, exclude finalized_timestamp attr from the default CLI outpunt.
Kami e1d085d
Fix lint.
Kami d9ad62b
Add python runner action which can be used for testing and timing large
Kami e20242f
Update changelog.
Kami 95de8ff
Add TODO comment.
Kami 42f70e7
Update the field and implement another approach which uses additional
Kami 8017e2a
Fix lint.
Kami cbb4cb1
Make tests more robust and less reliant on a specific global state.
Kami 49b4033
Re-generate requiremennts files.
Kami d93bd9d
Add -x flag to the st2 execution list command.
Kami c8f4022
Also apply the same field optimizations changes to all the workflows
Kami 88151da
Update changelog.
Kami a239061
For now, only utilize JSONDictField for fields which are for all
Kami 7cd3ec4
Implement dict value change tracking for our custom JSONDictField.
Kami 82965ef
Update more fields to use the new more efficient dict field.
Kami eaccea2
Add orquesta workflow action which can be used to test passing large
Kami 9682fac
Update API models to call public field method instead of calling orjson
Kami bc9e9c2
Update comments, add some tests for the public method.
Kami 2ac3fda
Apply same optimizatons to trigger_instance.payload field.
Kami 49d6134
Add correct file.
Kami 242c676
Update affected tests and API model.
Kami 75ab254
Also add benchmark for model with multiple fields of the same type and
Kami 4933573
Hook micro benchmarks to CI.
Kami e8745d8
Updat the new field type and make sure we also correctly track changes
Kami 560d616
Use consistent action name.
Kami 147a02b
Simplify the code - instead of having another finalized_timestamp
Kami 405e039
Update st2 execution get command to also display log attribute by
Kami 78f89ab
Update affected tests.
Kami 7810aa8
Also display log attribute on workflow executions.
Kami b31c006
Update affected tests - live action and action execution timestamp may
Kami 5988b5c
Throw more user-friendly error.
Kami 71791b3
micro-benchmarks task is very slow on CI so for now, only run it on
Kami 1d178df
Fix failing test, remove Python 2 code.
Kami 053bd93
Include the following changes which makes action registration 15-20%
Kami 824c2ea
Merge branch 'master' of github.com:StackStorm/st2 into optimize_esca…
Kami 1a99eee
Fix failing test.
Kami ca49b10
Fix rst syntax.
Kami 4289b9e
Pin mail-parser test dep to the latest version so tests work correctly.
Kami 9f0a6ba
Update more places in the code where we only work with simple / native
Kami 4793ba3
Update nose tests target to exclude resource registrar debug log
Kami dbc1460
Use correct path for pip cache dir.
Kami af961fb
Merge branch 'master' of github.com:StackStorm/st2 into optimize_esca…
Kami 64dbe5a
Use lazy import since right now zstandard is only used for tests and
Kami 167ca3f
Add a comment to custom yaml_safe_load() method.
Kami 8902d06
Better handle scenario when log attribute is already formatted.
Kami 6eabd5b
Add workaround for issue i've seen very seldomly on ci with trigger
Kami 2c2cb74
Make sure we don't call unescape_chars() on the JSONDictField field
Kami 93d859c
Update changelog.
Kami 2ea37db
Remove unused options.
Kami 0f293ee
Add additional timer metrics to the action runner which will provide
Kami a46831e
Merge branch 'master' of github.com:StackStorm/st2 into optimize_esca…
Kami c8c3b91
Merge branch 'master' of github.com:StackStorm/st2 into optimize_esca…
Kami b2ed03b
Remove incorrect log message which was causing unncessary log churn in
Kami 9feb81e
Also json instead of orjson so action can also be used with older
Kami 9f4f523
Store "result_size field on the ActionExecutionDB.
Kami d0f0d78
Add new WIP API endpoint for returning / downloading raw action
Kami b0dea78
Also add support for compressing and pretty printing the raw response.
Kami 756b916
Update URL path, add tests.
Kami a47461b
Update "result_size" field for action execution and live action DB model
Kami 2005126
Move calculation and setting of the result_size field to the
Kami 086be02
Add changelog entry.
Kami 8e0c312
Re-generate api spec.
Kami cd9eba7
Fix typo.
Kami 1a932ca
Fix failing test.
Kami e72215f
Merge branch 'master' of github.com:StackStorm/st2 into optimize_esca…
Kami 9e336d8
Fix merge conflicts.
Kami d373cf5
Fix test method name.
Kami 224dfba
Merge branch 'master' into optimize_escaped_dict_fields
Kami 3cc71ef
Add micro benchmark which times saving and reading large string value
Kami ac4efbd
Merge branch 'optimize_escaped_dict_fields' of github.com:StackStorm/…
Kami 051a691
Fix --with-schema flag which didn't work and threw and exception under
Kami 94b6298
Update CLI to use C version of the YAML safe dumper when pretty
Kami d1df1cd
Clarify the comment.
Kami b13c195
Add workaround for weird failure on CI which should not be fatatal.
Kami 51f811c
Log a warning message if pyyaml C bindings are not available since it
Kami 4672495
Upgrade orjson to latest stable version.
Kami a25efa6
Update out of date st2client setup.py metadata.
Kami bdd8e3c
Add a comment on libyaml availability.
Kami a098315
Update more code to use orjson and C versions of yaml load/dump
Kami e818158
Use fast dict copy.
Kami 48d612d
For performance reasons, use udatetime library for parsing rfc3339 /
Kami 71ffb1a
ujson is not only used for tests / benchmarks so move it to
Kami 46ba2c9
Fix typo.
Kami a27245f
Add TODO comment.
Kami 1a91394
Fix affected test.
Kami cbd0259
Apply suggestions from code review
Kami 3b47856
Fix syntax, add comments.
Kami File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,6 +152,10 @@ class ActionExecutionAPI(BaseAPI): | |
@classmethod | ||
def from_model(cls, model, mask_secrets=False): | ||
doc = cls._from_model(model, mask_secrets=mask_secrets) | ||
|
||
import json | ||
doc['result'] = json.loads(doc['result']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to add this to get the result in JSONDictEscapedFieldCompatibilityField with ujson/cjson backend to work properly. This is because _from_model will call to_mongo which dumps the result in JSON to string. The CLI output will be displayed as a string. |
||
|
||
start_timestamp = model.start_timestamp | ||
start_timestamp_iso = isotime.format(start_timestamp, offset=False) | ||
doc['start_timestamp'] = start_timestamp_iso | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bugs out because JSONDictEscapedFieldCompatibilityField is incompatible with EscapedDynamicField.