Skip to content

[BUG-python/deployment] TaskDistribution is not correctly received from server #5718

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

Closed
davidberenstein1957 opened this issue Nov 27, 2024 · 7 comments · Fixed by #5753
Closed
Assignees

Comments

@davidberenstein1957
Copy link
Contributor

davidberenstein1957 commented Nov 27, 2024

Describe the bug
I created a dataset with a specific task distribution (min_submitted=3) but when retrieving this back from the server I get only 1.

Stacktrace and Code to create the bug

import os

import argilla as rg
from dotenv import find_dotenv, load_dotenv

load_dotenv(find_dotenv())

client = rg.Argilla(
    api_url=os.getenv("ARGILLA_API_URL"),
    api_key=os.getenv("ARGILLA_API_KEY"),
)

print(client.datasets.list()[0].settings.distribution.min_submitted)

Expected behavior
To retrieve the actual min submitted

Environment:

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

Additional context

@frascuchon
Copy link
Member

Which version are you using? I cannot reproduce the error.

@jfcalvo
Copy link
Contributor

jfcalvo commented Nov 27, 2024

I'm successfully creating a dataset with min_submitted to 3. I'm doing it with the API and it's working as expected:

{
  "id": "0d5a92bb-b85e-44d7-b0ac-55433709a947",
  "name": "testing-url-images-different-strategy",
  "guidelines": null,
  "allow_extra_metadata": true,
  "status": "draft",
  "distribution": {
    "strategy": "overlap",
    "min_submitted": 3
  },
  "metadata": null,
  "workspace_id": "9b40ede0-87d5-4b20-9299-690c0c385c66",
  "last_activity_at": "2024-11-27T11:51:32.777932",
  "inserted_at": "2024-11-27T11:51:32.777932",
  "updated_at": "2024-11-27T11:51:32.777932"
}

Could it be a SDK specific problem?

@frascuchon
Copy link
Member

I've tested using the SDK, and it works as expected too

@davidberenstein1957
Copy link
Contributor Author

@jfcalvo @frascuchon I originally created it with a distribution of 1 and updated it within the UI to 3 after. Could that be related? I am using SDK 2.4.0 and server 2.4.1

@frascuchon
Copy link
Member

I've updated the dataset settings from the UI, and it's working.

@davidberenstein1957
Copy link
Contributor Author

@frascuchon @jfcalvo I found the issue.

# this passes
assert len(client.datasets) == 1
# this fails
assert client.datasets[0].settings.distribution.min_submitted == client.datasets(name="image_preferences").settings.distribution.min_submitted

@davidberenstein1957
Copy link
Contributor Author

davidberenstein1957 commented Nov 28, 2024

@jfcalvo @frascuchon it seems that when doing the self._from_model() we still need to call get() to update the settings config, even though we already seem to have this availale during but we are not using/passing the settings in the model init.

frascuchon added a commit that referenced this issue Nov 28, 2024
# Description
<!-- Please include a summary of the changes and the related issue.
Please also include relevant motivation and context. List any
dependencies that are required for this change. -->

When creating a `rg.Settings` instance with default distribution,
updates on the `min_submitted` attribute do not take effect.
````python

settings = rg.Settings(fields=...)

settings.distribution.min_submitted= 3 # this not takes effect
````

~Maybe related to #5718

**Type of change**
<!-- Please delete options that are not relevant. Remember to title the
PR according to the type of change -->

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

**How Has This Been Tested**
<!-- Please add some reference about how your feature has been tested.
-->

**Checklist**
<!-- Please go over the list and make sure you've taken everything into
account -->

- I added relevant documentation
- I followed 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/)
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 a pull request may close this issue.

3 participants