Skip to content

Commit

Permalink
Merge branch 'develop' into feat/add-dataset-automatic-task-distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
jfcalvo authored Jul 1, 2024
2 parents f62d58a + 22b357e commit 017001f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion argilla/src/argilla/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def __call__(self, name: str, workspace: Optional[Union["Workspace", str]] = Non

for dataset in workspace.datasets:
if dataset.name == name:
return dataset
return dataset.get()
warnings.warn(f"Dataset {name} not found. Creating a new dataset. Do `dataset.create()` to create the dataset.")
return Dataset(name=name, workspace=workspace, client=self._client, **kwargs)

Expand Down
9 changes: 6 additions & 3 deletions argilla/src/argilla/datasets/_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ def records(self) -> "DatasetRecords":

@property
def settings(self) -> Settings:
if self._is_published() and self._settings.is_outdated:
self._settings.get()
return self._settings

@settings.setter
Expand Down Expand Up @@ -142,6 +140,11 @@ def schema(self) -> dict:
# Core methods #
#####################

def get(self) -> "Dataset":
super().get()
self.settings.get()
return self

def exists(self) -> bool:
"""Checks if the dataset exists on the server
Expand Down Expand Up @@ -185,7 +188,7 @@ def _publish(self) -> "Dataset":
self._settings.create()
self._api.publish(dataset_id=self._model.id)

return self.get() # type: ignore
return self.get()

def _workspace_id_from_name(self, workspace: Optional[Union["Workspace", str]]) -> UUID:
if workspace is None:
Expand Down
1 change: 1 addition & 0 deletions argilla/tests/unit/test_resources/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def dataset(httpx_mock: HTTPXMock) -> rg.Dataset:
yield dataset


@pytest.mark.skip(reason="HTTP mocked calls must be updated")
class TestDatasets:
def url(self, path: str) -> str:
return f"http://test_url{path}"
Expand Down

0 comments on commit 017001f

Please sign in to comment.