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

Fields have created_at attribute #4730

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

swheaton
Copy link
Contributor

@swheaton swheaton commented Aug 26, 2024

What changes are proposed in this pull request?

Adds created_at property to all fo.Fields. Default is None but it is populated on newly-created fields.
This is only stored in the dataset doc sample_field and frame_field embedded document list fields, so the footprint is small.

Note: created_at is not propagated through to embedded document fields. Could add this on later if desired but for now the feature achieved what I needed without doing so.

Depends on branch last-modified-at so must be merged there.
Also depends on some other bug fixes such as #4729. But that was copied into the commit. Might just have merge conflicts.

How is this patch tested? If it is not, please explain why.

Added automated tests checking field created_at is only updated when the field is new.

from datetime import datetime
import time
import fiftyone as fo

def _assert_equalish(t1, t2):
  assert (t2-t1).total_seconds() < 0.1

now = datetime.utcnow()
ds = fo.Dataset()

for field in ds.get_field_schema().values():
  _assert_equalish(now, field.created_at)

time.sleep(1)
ds.add_sample_field("new_field", fo.StringField)
assert (ds.get_field("new_field").created_at - now).total_seconds() > 1

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

Added created_at property to every field.

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

Copy link
Contributor

coderabbitai bot commented Aug 26, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Base branches to auto review (4)
  • develop
  • main
  • release/.*
  • feat/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@brimoor brimoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I like it 💪

I'll give it a pass to make sure all cases are covered. Cloning datasets/views, merging fields, renaming/cloning fields, etc.

@swheaton
Copy link
Contributor Author

Thanks I tried to cover all cases but lmk if I missed one (or what I describe below is not what happens) and I'll add a test for it.

In particular,
Cloning dataset: created_at is reset to now for all
Merging: if only one side has a field, their created_at is kept. If both sides have the field, the destination dataset's created_at is kept for the field.
Import: created_at is reset to now, even though the original created_at time will be stored in the field for FiftyOneDataset format.
Cloning field: created_at is reset
Renaming field: created_at unchanged

@brimoor
Copy link
Contributor

brimoor commented Aug 28, 2024

Excellent, seems like you covered all bases 💪

@swheaton swheaton merged commit 0321a59 into last-modified-at Aug 30, 2024
@swheaton swheaton deleted the feat/index-frame-field-for-video-datasets branch August 30, 2024 14:06
brimoor pushed a commit that referenced this pull request Sep 12, 2024
* Fields have created_at attribute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants