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

feat: DIA-870: Add ModelInterface model/api #5347

Closed
wants to merge 7 commits into from

Conversation

hakan458
Copy link
Collaborator

@hakan458 hakan458 commented Jan 23, 2024

PR fulfills these requirements

  • Commit message(s) and PR title follows the format [fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made ex. fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
  • Tests for the changes have been added/updated (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • Best efforts were made to ensure docs/code are concise and coherent (checked for spelling/grammatical errors, commented out code, debug logs etc.)
  • Self-reviewed and ran all changes on a local instance (for bug fixes/features)

Change has impacts in these area(s)

(check all that apply)

  • Product design
  • Backend (Database)
  • Backend (API)
  • Frontend

Describe the reason for change

(link to issue, supportive screenshots etc.)

What does this fix?

(if this is a bug fix)

What is the new behavior?

(if this is a breaking or feature change)

What is the current behavior?

(if this is a breaking or feature change)

What libraries were added/updated?

(list all with version changes)

Does this change affect performance?

(if so describe the impacts positive or negative)

Does this change affect security?

(if so describe the impacts positive or negative)

What alternative approaches were there?

(briefly list any if applicable)

What feature flags were used to cover this change?

(briefly list any if applicable)

Does this PR introduce a breaking change?

(check only one)

  • Yes, and covered entirely by feature flag(s)
  • Yes, and covered partially by feature flag(s)
  • No
  • Not sure (briefly explain the situation below)

What level of testing was included in the change?

(check all that apply)

  • e2e
  • integration
  • unit

Which logical domain(s) does this change affect?

(for bug fixes/features, be as precise as possible. ex. Authentication, Annotation History, Review Stream etc.)

Copy link

netlify bot commented Jan 23, 2024

Deploy Preview for label-studio-docs-new-theme ready!

Name Link
🔨 Latest commit 60c1d9a
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/65b8403b3397f900085ca948
😎 Deploy Preview https://deploy-preview-5347--label-studio-docs-new-theme.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 23, 2024

Deploy Preview for heartex-docs ready!

Name Link
🔨 Latest commit 60c1d9a
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/65b8403b9fe5b60008e245c6
😎 Deploy Preview https://deploy-preview-5347--heartex-docs.netlify.app/guide/billing
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the feat label Jan 23, 2024
Copy link

codecov bot commented Jan 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (522b241) 75.88% compared to head (97caacc) 76.00%.
Report is 6 commits behind head on develop.

❗ Current head 97caacc differs from pull request most recent head 60c1d9a. Consider uploading reports for the commit 60c1d9a to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #5347      +/-   ##
===========================================
+ Coverage    75.88%   76.00%   +0.11%     
===========================================
  Files          154      159       +5     
  Lines        12931    12989      +58     
===========================================
+ Hits          9813     9872      +59     
+ Misses        3118     3117       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

)

def get_queryset(self):
return ModelInterface.objects.filter(organization_id=self.request.user.active_organization_id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this how we manage which, for example, projects a user sees? Is it based solely on the organization they're in? Maybe better question: is it possible for there to be a project inside an org I belong to that I can't see?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No in projects lands there are multiple layers
Lets start with datasets land - this is closer to what we will have here
If user is an admin or owner, they see all datasets in the org
Otherwise, they will see datasets they are a member of. Since we do not have these requirements defined, for now I am returning all models of an org for all users, very easy to add the granularity later on.
Datasets example: https://github.com/HumanSignal/label-studio-enterprise/blob/develop/label_studio_enterprise/datasets/api.py#L121

serializer.is_valid(raise_exception=True)

# we need to save these fields for faster access and filters without excess joins
serializer.validated_data['organization'] = self.request.user.active_organization
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar question here to above: do we set this for projects based on the current org too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure what you mean exactly, but yes we set the org field of a project, or a dataset, to the org that a user is in while creating the object

)

def has_permission(self, user):
return True # TODO - which roles have access by default?
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add an AC or anything in the follow up ticket to do something more principled here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will make a ticket to pin down requirements on permissions of models, its not clear yet

label_studio/ml_models/serializers.py Show resolved Hide resolved
label_studio/tests/test_ml_models.tavern.yml Outdated Show resolved Hide resolved
@pakelley
Copy link
Contributor

This lgtm, but wanted to ask before "approving": which branch did you want this to live in for now? Just on this one, or a more general "prompter" type branch?

@hakan458
Copy link
Collaborator Author

Closing in favor of #5388

@hakan458 hakan458 closed this Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants