-
Notifications
You must be signed in to change notification settings - Fork 5
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
Performance Improvement: removed DB Schema validation from update_if_valid()
#361
Conversation
… A LOT * changed the docstrings and code to reflect the new updates
Merging to
|
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.
Absolutely not a fan of this.
I won't approve.
Human time, working with the SDK is always more valuable then computer time.
Debugging any script with the SDK without this check is an absolute nightmare.
DB Schema error hard to understand in the first place for users, but if the error now pops up at an unexpected location and at a place where you can't figure out its origin is an absolute no go.
If you are really so concerned about CPU performance, make this a flag in the API class.
api.disable_db_schema_check
and api.enable_db_schema_check
.
And default is checks on.
If a user is done debugging their script and are concerned about performance they can disable the checks.
I also think that this is the wrong place to disable the checks, in my opinion the disabling should happen in api._is_node_schema_valid
, hiding it in a node function that is called upon updating seems cryptic to me.
Also this check should 100% be on for our unit tests. |
I do agree that the function looks a bit cryptic because we are saying "update if valid" and then we are just updating it regardless. I was thinking of first putting this idea out and seeing which parts we like and dislike and after we come to agreement we can figure out the rest of refactoring/renaming to make it more readable. I figured we'd probably disagree about this and need to find a middle ground. I can do a flag, but then we won't have any db schema validation instead of having it in fewer places, which is not ideal.
I agree, but that is the issues because as the user is sitting trying to run their program, it takes forever for it to run and give back the error. If only uploads were slow then it would make sense, but human time is wasted here waiting for the computer to run and after a long time give an error or success. I bet the errors will be equally as helpful in debugging if we have it in one place instead of many places. We could also try to do an experiment or user testing for this as well to be more sure.
I think it would actually be okay because we have some pretty good validation with beartype and our setters and getters are written nicely and the db schema gives pretty good error are pretty easy and understand and debug from. Tell me more about your thoughts on what would be hard. Was there a time that you were struggling with the error and had a hard time debugging this SDK? |
I think the API also runs the DB schema checks so we have another safety there and gives back the db schema errors. We could also try to have the db schema run at the end of every unit tests, not sure how to do that yet, but if we like that idea maybe we can research more into it and go from there |
A flag is good. It will be validated by API anyways, so forceful validation here should be fine. |
Yes, but the feedback from API on DB schema error is really cryptic and I don't think it is effort well spend that we decode this message for the users. |
In the flag solution, I would just not set the flag for our unit tests. |
I can write the flag in and I'm thinking of doing it how I wrote the |
not sure if I'd want to write a test for this because it is too small and simple and a test for it might just be overkill |
Description
removed DB Schema validation from
update_if_valid()
to improve performanceIssue Link
https://trello.com/c/1wBnrbBw
Changes
update_if_valid
methodScreenshots
click to see test performance before
click to see test performance after
Notes
Checklist
CONTRIBUTORS.md
) in the pull request source branch.