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

Enhancements to ODM migration #28

Merged
merged 28 commits into from
May 6, 2020
Merged

Enhancements to ODM migration #28

merged 28 commits into from
May 6, 2020

Conversation

brimoor
Copy link
Contributor

@brimoor brimoor commented May 6, 2020

Change log

  • BackedByDocument subclasses now explicitly implement their create_new() methods and call BackedByDocument._create_new() to construct the underlying ODMDocuments. The reason for this is documentation: Sample.create_new() needs to exist so that the meaning of all of the relevant fields can be clearly documented for the user to understand what's going on. The previous implementation with get_odm_kwargs() was hiding all of that. Also, it's a good practice to avoid constructing dictionaries of parameters in code. Dictionaries are magic things that can contain anything. It's better to pass keyword arguments around as keyword arguments, so your IDE/linter/static analyzer can tell what's happening and warn if a particular parameter is not valid
  • implementing Dataset.add_samples(). IDK if this is efficient or not, but it does work
  • updating fiftyone.core.labels.Label classes to use new interface. This includes adding ODMDocument classes to back these constructs in the DB
  • implementing Sample.add_label()

Miscellaneous

  • documentation and other enhancements

@brimoor brimoor added the enhancement Code enhancement label May 6, 2020
@brimoor brimoor requested a review from tylerganter May 6, 2020 15:06
@brimoor brimoor self-assigned this May 6, 2020
@brimoor
Copy link
Contributor Author

brimoor commented May 6, 2020

@tylerganter added more stuff to this PR. See changelog

@property
def name(self):
return self._name
if not create_empty and not self:
Copy link
Contributor

Choose a reason for hiding this comment

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

what does not self mean here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I understand what it means now, missed the definition of __bool__. But I suppose we have a minor issue that creating an empty dataset is meaningless. It does nothing on the backend ATM. So we may need some way of tracking that in the future. I would just mark it as a todo and move on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I noted that. We can move on for now

@tylerganter tylerganter self-requested a review May 6, 2020 17:29
Copy link
Contributor

@tylerganter tylerganter left a comment

Choose a reason for hiding this comment

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

LGTM, thanks so much for the help with this. Noting the one comment I made that isn't resolved I think we can just add a TODO

@brimoor brimoor merged commit 44315d9 into mongo-odm May 6, 2020
@brimoor brimoor deleted the odm-tweaks branch May 6, 2020 17:34
kaixi-wang pushed a commit that referenced this pull request May 11, 2023
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.

2 participants