-
Notifications
You must be signed in to change notification settings - Fork 1
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
Replaced json with orjson for large size loads #662
base: dev
Are you sure you want to change the base?
Conversation
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.
Awesome stuff! Note my 2 review comments before merging, but broadly supportive of this change. I was going to suggest looking at replacing it for Pydantic (I don't actually know which version we use), but looks like there is some ongoing discussion here: pydantic/pydantic#6388
So maybe best to leave that for now.
db/python/layers/web.py
Outdated
SearchItem, | ||
parse_sql_bool, | ||
) | ||
from models.models import (AssayInternal, FamilySimpleInternal, |
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 is a fun linting one, soon to be resolved in metamist, but your default isort profile in VSCode is incorrect, in your VSCode settings.json you can add:
"isort.args": [
"--profile=black"
],
We intend to add this to metamist's pyproject.toml soon (to replicate https://github.com/populationgenomics/cpg-python-template-repo/blob/6e2da21e1012e6d2b15ba0c385da579a9b80b550/pyproject.toml#L7), but we were waiting for other big PRs to be finalised before introducing lots of merge conflicts.
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.
Reverted and fixed! I assume that replication to metamist will happen along with the new pre-commit
hooks?
I'm in this rabbit hole now since the discussion leads to |
I don't feel well versed with the different python libraries, looks like the conversation is pretty fresh so happy to wait - (what version of Pydanctic do we use?) |
Believe |
Awesome, I tried to bump our fastapi, but there's an issue with the openapi version and the generator we use #643 (I think this issue has more commentary). Is this PR good to merge if we don't want to touch that side? |
I think this should be good to merge for now. |
Description
This is based off #658 which proposes to switch to
orjson
in place of the standardjson
library, for deserialising values that might be large. This switch should offer a significant cut in loading times, without introducing any code complexity.Changes Made
json.loads
calls withorjson.loads
where deemed appropriate. This replacement has not been done on low-impact calls that deserialise small objects.Notes
orjson
when introducing any new features/fixes that involving deserialising of large objects.Closes