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

[ENHANCEMENT/REFACTOR] argilla: lazy resolution for dataset workspaces #5152

Merged

Conversation

frascuchon
Copy link
Member

This PR removes the workspace resolution on Dataset.__init__ and performs it lazily when creating datasets or accessing the dataset.workspace property

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (change restructuring the codebase without changing functionality)
  • Improvement (change adding some improvement to an existing functionality)
  • Documentation update

How Has This Been Tested

Checklist

  • I added relevant documentation
  • follows the style guidelines of this project
  • I did a self-review of my code
  • I made corresponding changes to the documentation
  • I confirm My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

Copy link
Contributor

@burtenshaw burtenshaw left a comment

Choose a reason for hiding this comment

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

Looks good. One question: how would Dataset.exist behave if there's no workspace in the dataset resource? This method confuses a lot of users.

@frascuchon
Copy link
Member Author

frascuchon commented Jul 4, 2024

The .exists method uses the resource ID internally, so a workspace is unnecessary for this query. Yes, I see the confusion of users setting datasets with a name and a workspace and checking the existence of the dataset.

maybe this existence method should be defined at the client level:

client.datasets.exists(dataset)
#or 
client.datasets.exists(name, workspace)

Just to force a direct client interaction to make more sense to the "exists" query.

@burtenshaw
Copy link
Contributor

burtenshaw commented Jul 4, 2024

The .exists method uses the resource ID internally, so a workspace is unnecessary for this query. Yes, I see the confusion of users setting datasets with a name and a workspace and checking the existence of the dataset.

maybe this existence method should be defined at the client level:

client.datasets.exists(dataset)
#or 
client.datasets.exists(name, workspace)

Just to force a direct client interaction to make more sense to the "exists" query.

Yeah. I think this would solve it because in most cases the user just wants to know 'can I use this name?'

This could be implemented in a subsequent PR though.

@frascuchon frascuchon merged commit 54d2e60 into develop Jul 4, 2024
7 checks passed
@frascuchon frascuchon deleted the feat/argilla/lazy-resolution-for-dataset-workspaces branch July 4, 2024 10:41
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