Skip to content
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

Revalidate stages upon view reload #2890

Merged
merged 3 commits into from
Apr 21, 2023
Merged

Revalidate stages upon view reload #2890

merged 3 commits into from
Apr 21, 2023

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented Apr 9, 2023

Calling reload() now causes view stages to be re-validated, which allows for views to take into account any changes to the underlying dataset that occurred after the view is created.

In general, one can always reconstruct views from scratch, but reload() is now more a more viable option in cases where it is desired to continue using an existing DatasetView instance while a dataset may be changing underneath.

Example use case:

import fiftyone as fo
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")
view = dataset.select_fields("uniqueness")

dataset.delete_sample_field("uniqueness")

# Immediately raises an error, since `uniqueness` field was deleted
view.reload()
# ValueError: Field 'uniqueness' does not exist

@brimoor brimoor added the enhancement Code enhancement label Apr 9, 2023
@brimoor brimoor requested a review from a team April 9, 2023 02:43
@brimoor brimoor self-assigned this Apr 9, 2023
@codecov
Copy link

codecov bot commented Apr 9, 2023

Codecov Report

Patch coverage: 82.87% and project coverage change: +0.07 🎉

Comparison is base (3311694) 61.97% compared to head (80785a4) 62.05%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2890      +/-   ##
===========================================
+ Coverage    61.97%   62.05%   +0.07%     
===========================================
  Files          259      259              
  Lines        43808    43974     +166     
  Branches       350      350              
===========================================
+ Hits         27150    27288     +138     
- Misses       16658    16686      +28     
Flag Coverage Δ
app 48.60% <35.41%> (-0.03%) ⬇️
python 99.43% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
app/packages/looker/src/overlays/heatmap.ts 16.06% <0.00%> (-0.33%) ⬇️
app/packages/looker/src/overlays/util.ts 25.25% <16.66%> (-1.19%) ⬇️
app/packages/state/src/recoil/selectors.ts 43.92% <27.27%> (-0.85%) ⬇️
app/packages/looker/src/worker/index.ts 100.00% <100.00%> (ø)
tests/unittests/aggregation_tests.py 99.65% <100.00%> (+0.01%) ⬆️
tests/unittests/dataset_tests.py 99.84% <100.00%> (+<0.01%) ⬆️
tests/unittests/similarity_tests.py 97.95% <100.00%> (+0.52%) ⬆️
tests/unittests/view_tests.py 99.86% <100.00%> (+<0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@brimoor brimoor merged commit c55da76 into develop Apr 21, 2023
@brimoor brimoor deleted the reload branch April 21, 2023 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Code enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant