-
Notifications
You must be signed in to change notification settings - Fork 142
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
[Feat] Make dynamic data loading functions accept arguments #479
Merged
Conversation
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
… figure["data_frame"]. Seems to work ok
… don't enable for now" This reverts commit 92e6c68.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
antonymilne
changed the title
Add *args, **kwargs to load and many more tests
[Feat] Make dynamic data loading functions accepts arguments
May 14, 2024
antonymilne
changed the title
[Feat] Make dynamic data loading functions accepts arguments
[Feat] Make dynamic data loading functions accept arguments
May 14, 2024
1 task
Signed-off-by: Antony Milne <49395058+antonymilne@users.noreply.github.com>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
7 tasks
for more information, see https://pre-commit.ci
…/mckinsey/vizro into feat/dynamic-data-load-with-args
petar-qb
approved these changes
May 17, 2024
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.
After thorough code (and tests) inspection and manual testing with a few the most representative combinations from #398 (comment), I didn't spot anything that amiss. As expected 😄
Also, many thanks for all your code/tests and PR comments. They made my life easier.
…fied signature" This reverts commit 191868f.
antonymilne
force-pushed
the
feat/dynamic-data-load-with-args
branch
from
May 20, 2024 11:18
b9c4c95
to
c8892d1
Compare
Joseph-Perkins
approved these changes
May 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This is step 1 out of 2 in completing https://github.com/McK-Internal/vizro-internal/issues/753/ to allow for parametrisation of dynamic data from the frontend.
Here I just implement the changes needed to the data manager. I anticipated this would be as simple as adding
*args, **kwargs
in a couple of places, but it turned out to be much more complicated than that. In short:def f(a=1): ...
, we needf(a=1)
andf(1)
andf()
to all have same cache key) flask-caching relies on inspecting the signature of the function being memoized_DynamicData.load
bound method, but it is basically impossible for this to be done in a way that mirrors the signature of the underlyingload_data
function (details in How to use adapter factory to change signature depending on instance GrahamDumpleton/wrapt#263)load
function itselfpartial
function named with the data source name. This ensures that both bound methods and functions are handled correctly, with caches keyed by data source namepartial
functions now works so I've removed the error raised inDataManager.__setitem__
Also I've written many more tests to check this all works. These are a bit slow because they run for many different functions and include
time.sleep
. If they become annoying to run in CI we can tag them as slow and split them out or skip them or something.To do in this PR
To do in following PR #482
To do separately
log_call
Screenshot
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":