-
Notifications
You must be signed in to change notification settings - Fork 509
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
Sample/frame created_at & Dataset/Sample/Frame last_updated_at #3805
Draft
swheaton
wants to merge
13
commits into
develop
Choose a base branch
from
feature/last-updated-at-2
base: develop
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
7 tasks
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #3805 +/- ##
===========================================
- Coverage 16.16% 15.52% -0.65%
===========================================
Files 641 653 +12
Lines 74140 74834 +694
Branches 982 996 +14
===========================================
- Hits 11988 11620 -368
- Misses 62152 63214 +1062
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
What changes are proposed in this pull request?
Add
created_at
field to all samples and frames. It's set to "now" when added to the dataset, and reset back toNone
if removed from the dataset.Add
last_updated_at
field to all samples and frames. It's set to now when added to the dataset, , and reset back toNone
if removed from the dataset.Add
last_updated_at
to Dataset document which is updated whenever the document is saved.Add
Dataset.last_updated_at
property which is equal to this pseudocode:TODO
CreatedAt Notes
created_at
were identified using as a template adding dataset id to sample and frames docscreated_at
if the sample gets created outside of the dataset first, but it's easier to do it this way and there's not likely to be a meaningful distinction between when a sample was created and when added to dataset.add_samples()
call, each batch of samples will get the samecreated_at
time.addField
but then add it todelete_fields
when we create thewhenMatched
pipeline, we'll make sure that it will be added on insert but ignored on merge.Frames Notes
frames.save()
. This means all of theirlast_updated_at
times are set tonow
, even if there was no edits made to that frame.sample.frames
. Now we are callingself._dataset._update_last_updated_at([self._sample_id])
. This will be another call to mongo so we should definitely not be updating frames in a loop (shouldn't be doing that anyways!).deferred
doesn't exactly work (used forSaveContext
I think?) because theops
that are gathered are for the frame collection but there's currently no way to return ops for the sample collection.Readonly Notes
set_field
,__setattr__
,set_values()
,clear_sample_field
, etc., are prohibited.readonly
flag for theField
, akin to theis_virtual
property in virtual fields PR.Performance Notes
last_updated_at
field.last_updated_at
time O(1).filepath
index would be rarely or never updated).timeit.Timer('ds.set_values("foo", [random.randint(0, 100000)] * 10000)', setup=setup).repeat(5, 10)
last_updated_at
time has a performance impact on writes. Using the above test outside this branch, the minimal value is 4.41s. Compared to the 5.74s indexed form above, this is a 28% increase in write time.How is this patch tested? If it is not, please explain why.
add_samples()
clone()
add_collection(new_ids=True)
merge_samples() # both existing and new samples
fo.Dataset.from_dir()
last_updated_at
time, anddataset.last_updated_at
is equal.last_updated_at
time.Release Notes
Is this a user-facing change that should be mentioned in the release notes?
notes for FiftyOne users.
Add
created_at
defaultDateTimeField
to samples and frames, which contains the time the sample was added to the dataset.What areas of FiftyOne does this PR affect?
fiftyone
Python library changes