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: create user with workspaces #3462

Merged
merged 14 commits into from
Aug 1, 2023

Conversation

gabrielmbmb
Copy link
Member

Description

This PR updates the API and the Python client so a list of workspaces names to which the user should be linked to can be provided. This is useful when creating a new user, as just one request will be needed, instead of the current behaviour, which requires one to create the user and another one to add the user to the workspace.

In addition, the code blocks in which a commit or a rollback has to be done depending on wether an exception is raised have been updated to use the async context manager async with session.begin_nested(): which automatically will commit if the block is executed without any problem or rollback if an exception is raised.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Improvement (change adding some improvement to an existing functionality)

How Has This Been Tested

I've been able to create a user with workspaces in a local development environment. Also, the unit tests regarding the user creation have been updated.

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
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I filled out the contributor form (see text above)
  • I have added relevant notes to the CHANGELOG.md file (See https://keepachangelog.com/)

@gabrielmbmb gabrielmbmb added client area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints labels Jul 27, 2023
@gabrielmbmb gabrielmbmb added this to the v1.14.0 milestone Jul 27, 2023
@gabrielmbmb gabrielmbmb self-assigned this Jul 27, 2023
@gabrielmbmb gabrielmbmb marked this pull request as ready for review July 27, 2023 08:59
@codecov
Copy link

codecov bot commented Jul 28, 2023

Codecov Report

Patch coverage: 91.95% and project coverage change: +0.09% 🎉

Comparison is base (6630d7b) 90.13% compared to head (7c6000d) 90.23%.
Report is 121 commits behind head on develop.

❗ Current head 7c6000d differs from pull request most recent head 2c51b72. Consider uploading reports for the commit 2c51b72 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3462      +/-   ##
===========================================
+ Coverage    90.13%   90.23%   +0.09%     
===========================================
  Files          233      248      +15     
  Lines        12493    13235     +742     
===========================================
+ Hits         11261    11943     +682     
- Misses        1232     1292      +60     
Flag Coverage Δ
pytest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...ack/integrations/huggingface/card/_dataset_card.py 100.00% <ø> (ø)
.../feedback/integrations/huggingface/card/_parser.py 100.00% <ø> (ø)
...rgilla/client/feedback/training/frameworks/peft.py 0.00% <0.00%> (ø)
...client/feedback/training/frameworks/span_marker.py 0.00% <0.00%> (ø)
src/argilla/client/feedback/types.py 100.00% <ø> (ø)
src/argilla/client/sdk/commons/errors.py 72.22% <ø> (ø)
src/argilla/feedback/__init__.py 100.00% <ø> (ø)
...rc/argilla/metrics/token_classification/metrics.py 98.79% <ø> (ø)
src/argilla/monitoring/_flair.py 86.66% <ø> (ø)
src/argilla/monitoring/_transformers.py 94.11% <ø> (ø)
... and 77 more

... and 65 files with indirect coverage changes

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

Copy link
Member

@alvarobartt alvarobartt 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 🤗

src/argilla/client/users.py Outdated Show resolved Hide resolved
src/argilla/server/apis/v0/handlers/users.py Show resolved Hide resolved
@gabrielmbmb gabrielmbmb force-pushed the feature/create-user-endpoint-with-workspaces branch from 085abf1 to 2c51b72 Compare July 31, 2023 15:46
@gabrielmbmb gabrielmbmb merged commit a44d8bc into develop Aug 1, 2023
@gabrielmbmb gabrielmbmb deleted the feature/create-user-endpoint-with-workspaces branch August 1, 2023 07:22
gabrielmbmb added a commit that referenced this pull request Aug 3, 2023
# Description

This PR fixes the issue (reported by @damianpumar), where the values of
an already created response for a given record were not updated, even
the server returned a `200`. The bug was introduced in #3462, where the
`try: ... db.commit() except Exception: ... db.rollback()` where
replaced with `async with db.begin_nested()` block.

**Type of change**

- [x] Bug fix (non-breaking change which fixes an issue)

**How Has This Been Tested**

The Docker image of this branch has been deployed in `dev.argilla.io`,
where I was able to update the values of a response, refresh the page
and see the updated values.

**Checklist**

- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [x] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [x] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
keithCuniah pushed a commit that referenced this pull request Aug 3, 2023
# Description

This PR updates the API and the Python client so a list of workspaces
names to which the user should be linked to can be provided. This is
useful when creating a new user, as just one request will be needed,
instead of the current behaviour, which requires one to create the user
and another one to add the user to the workspace.

In addition, the code blocks in which a commit or a rollback has to be
done depending on wether an exception is raised have been updated to use
the async context manager `async with session.begin_nested():` which
automatically will commit if the block is executed without any problem
or rollback if an exception is raised.

**Type of change**

- [x] New feature (non-breaking change which adds functionality)
- [x] Improvement (change adding some improvement to an existing
functionality)

**How Has This Been Tested**

I've been able to create a user with workspaces in a local development
environment. Also, the unit tests regarding the user creation have been
updated.

**Checklist**

- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [x] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [x] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
keithCuniah pushed a commit that referenced this pull request Aug 3, 2023
# Description

This PR fixes the issue (reported by @damianpumar), where the values of
an already created response for a given record were not updated, even
the server returned a `200`. The bug was introduced in #3462, where the
`try: ... db.commit() except Exception: ... db.rollback()` where
replaced with `async with db.begin_nested()` block.

**Type of change**

- [x] Bug fix (non-breaking change which fixes an issue)

**How Has This Been Tested**

The Docker image of this branch has been deployed in `dev.argilla.io`,
where I was able to update the values of a response, refresh the page
and see the updated values.

**Checklist**

- [ ] I added relevant documentation
- [x] follows the style guidelines of this project
- [x] I did a self-review of my code
- [x] I made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [x] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants