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

[BUG] dB issue after deleting a dataset #3808

Closed
dvsrepo opened this issue Sep 21, 2023 · 3 comments · Fixed by #4142
Closed

[BUG] dB issue after deleting a dataset #3808

dvsrepo opened this issue Sep 21, 2023 · 3 comments · Fixed by #4142
Assignees
Labels
area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints type: bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@dvsrepo
Copy link
Member

dvsrepo commented Sep 21, 2023

Describe the bug

  1. I have deleted a dataset (using owner)
  2. I tried to create it again (same name, same workspace)
  3. It fails with:
Exception: Failed while adding the records to the `FeedbackDataset` in Argilla with exception: Argilla server 
returned an error with http status: 500
Error details: [{'code': 'argilla.api.errors::GenericServerError', 'params': {'type': 
'sqlalchemy.exc.MissingGreenlet', 'message': "greenlet_spawn has not been called; can't call await_only() here. Was
IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/20/xd2s)"}}]

Stacktrace and Code to create the bug

# dataset.add_records...
_ = dataset.push_to_argilla("content-generation-quality", workspace="content-team")

Expected behavior
Not fail

Environment:

  • Argilla Version [e.g. 1.0.0]: 1.16
  • ElasticSearch Version [e.g. 7.10.2]:
  • Docker Image (optional) [e.g. argilla:v1.0.0]: quickstart

Additional context
Instance available at https://huggingface.co/spaces/argilla/rg-demo

Full stack trace:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/danielvilasuero/Library/Python/3.9/lib/python/site-packages/argilla/client/feedback/datas │
│ et/mixins.py:122 in __push_records                                                               │
│                                                                                                  │
│   119 │   │   │   │   │   │   │   exclude={"id": ..., "suggestions": {"__all__": {"question_na   │
│   120 │   │   │   │   │   │   )                                                                  │
│   121 │   │   │   │   │   )                                                                      │
│ ❱ 122 │   │   │   │   datasets_api_v1.add_records(client=client, id=id, records=records)         │
│   123 │   │   │   except Exception as e:                                                         │
│   124 │   │   │   │   self.__delete_dataset(client=client, id=id)                                │
│   125 │   │   │   │   raise Exception(                                                           │
│                                                                                                  │
│ /Users/danielvilasuero/Library/Python/3.9/lib/python/site-packages/argilla/client/sdk/v1/dataset │
│ s/api.py:249 in add_records                                                                      │
│                                                                                                  │
│   246 │                                                                                          │
│   247if response.status_code == 204:                                                        │
│   248 │   │   return Response.from_httpx_response(response)                                      │
│ ❱ 249return handle_response_error(response)                                                 │
│   250                                                                                            │
│   251                                                                                            │
│   252 def delete_records(                                                                        │
│                                                                                                  │
│ /Users/danielvilasuero/Library/Python/3.9/lib/python/site-packages/argilla/client/sdk/commons/er │
│ rors_handler.py:64 in handle_response_error                                                      │
│                                                                                                  │
│   61 │   │   error_type = GenericApiError                                                        │
│   62else:                                                                                   │
│   63 │   │   raise HttpResponseError(response=response)                                          │
│ ❱ 64raise error_type(**error_args)                                                          │
│   65                                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
GenericApiError: Argilla server returned an error with http status: 500
Error details: [{'code': 'argilla.api.errors::GenericServerError', 'params': {'type': 
'sqlalchemy.exc.MissingGreenlet', 'message': "greenlet_spawn has not been called; can't call await_only() here. Was
IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/20/xd2s)"}}]

The above exception was the direct cause of the following exception:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:46                                                                                   │
│                                                                                                  │
│   43 │   │   │   )                                                                               │
│   44 │   │   )                                                                                   │
│   45                                                                                             │
│ ❱ 46 _ = dataset.push_to_argilla("content-generation-quality", workspace="content-team")         │
│   47                                                                                             │
│                                                                                                  │
│ /Users/danielvilasuero/Library/Python/3.9/lib/python/site-packages/argilla/client/feedback/datas │
│ et/mixins.py:179 in push_to_argilla                                                              │
│                                                                                                  │
│   176 │   │                                                                                      │
│   177 │   │   self.__publish_dataset(client=httpx_client, id=argilla_id)                         │
│   178 │   │                                                                                      │
│ ❱ 179 │   │   self.__push_records(                                                               │
│   180 │   │   │   client=httpx_client, id=argilla_id, show_progress=show_progress, question_ma   │
│   181 │   │   )                                                                                  │
│   182                                                                                            │
│                                                                                                  │
│ /Users/danielvilasuero/Library/Python/3.9/lib/python/site-packages/argilla/client/feedback/datas │
│ et/mixins.py:125 in __push_records                                                               │
│                                                                                                  │
│   122 │   │   │   │   datasets_api_v1.add_records(client=client, id=id, records=records)         │
│   123 │   │   │   except Exception as e:                                                         │
│   124 │   │   │   │   self.__delete_dataset(client=client, id=id)                                │
│ ❱ 125 │   │   │   │   raise Exception(                                                           │
│   126 │   │   │   │   │   f"Failed while adding the records to the `FeedbackDataset` in Argill   │
│   127 │   │   │   │   ) from e                                                                   │
│   128                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Exception: Failed while adding the records to the `FeedbackDataset` in Argilla with exception: Argilla server 
returned an error with http status: 500
Error details: [{'code': 'argilla.api.errors::GenericServerError', 'params': {'type': 
'sqlalchemy.exc.MissingGreenlet', 'message': "greenlet_spawn has not been called; can't call await_only() here. Was
IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/20/xd2s)"}}]
@dvsrepo dvsrepo added type: bug Indicates an unexpected problem or unintended behavior area: api Indicates that an issue or pull request is related to the Fast API server or REST endpoints labels Sep 21, 2023
@dvsrepo dvsrepo assigned dvsrepo and gabrielmbmb and unassigned dvsrepo Sep 21, 2023
@alvarobartt
Copy link
Member

I think this may be related to #3746 and AFAIK @gabrielmbmb will work on it! Thanks for reporting 🤗

@dvsrepo
Copy link
Member Author

dvsrepo commented Sep 22, 2023

After rebooting the instance the problem disappeared

@dvsrepo dvsrepo changed the title [BUG] [BUG] dB issue after deleting a dataset Sep 22, 2023
@gabrielmbmb
Copy link
Member

Checking!

@frascuchon frascuchon added this to the v1.19.0 milestone Nov 6, 2023
frascuchon added a commit that referenced this issue Nov 7, 2023
<!-- Thanks for your contribution! As part of our Community Growers
initiative 🌱, we're donating Justdiggit bunds in your name to reforest
sub-Saharan Africa. To claim your Community Growers certificate, please
contact David Berenstein in our Slack community or fill in this form
https://tally.so/r/n9XrxK once your PR has been merged. -->

# Description

Using the search engine to execute all kinds of queries over records
will simplify problems with offsets, limits, and other stuff when using
directly the DB.

This PR makes the needed changes to fetching records based on the search
engine

Also, an error has been fixed when creating records with responses,
since the user info is not properly loaded before sending it to the
search index.

Closes [#3746](#3746) and
#3808

**Type of change**

(Please delete options that are not relevant. Remember to title the PR
according to the type of change)

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

**How Has This Been Tested**

(Please describe the tests that you ran to verify your changes. And
ideally, reference `tests`)

- Some local tests have been applied

**Checklist**

- [x] I followed the style guidelines of this project
- [ ] I did a self-review of my code
- [ ] 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/)

---------

Co-authored-by: José Francisco Calvo <josefranciscocalvo@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: José Francisco Calvo <jose@argilla.io>
@frascuchon frascuchon linked a pull request Nov 8, 2023 that will close this issue
8 tasks
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 type: bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants