Skip to content

Commit

Permalink
docs: Add section from empty workspaces migration (#2382)
Browse files Browse the repository at this point in the history
This is a missing section for migrating datasets with empty workspaces.
It will be mandatory for the next release.

This section will be referenced in the next release, once this PR #2373
is included.

---------

Co-authored-by: David Berenstein <david.m.berenstein@gmail.com>
  • Loading branch information
frascuchon and davidberenstein1957 authored Feb 22, 2023
1 parent bb14f3c commit d0f8882
Showing 1 changed file with 69 additions and 19 deletions.
88 changes: 69 additions & 19 deletions docs/_source/guides/log_load_and_prepare_data.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "d09c1533-97fd-43f7-83ea-f3a56edd1d5e",
"metadata": {},
Expand All @@ -16,7 +15,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "ae9d4c9e-24a1-4a59-8a17-3b6ac1a39c88",
"metadata": {},
Expand Down Expand Up @@ -108,7 +106,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "14a65408",
"metadata": {},
Expand Down Expand Up @@ -171,7 +168,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "a3f35f3b",
"metadata": {},
Expand Down Expand Up @@ -204,7 +200,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "b6cc89f8",
"metadata": {},
Expand All @@ -215,7 +210,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "381b5f0b",
"metadata": {},
Expand Down Expand Up @@ -244,7 +238,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "ee0f9b20",
"metadata": {},
Expand Down Expand Up @@ -280,7 +273,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "eed77791",
"metadata": {},
Expand Down Expand Up @@ -310,7 +302,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "df88889b-12f4-472f-bcbe-fb47be475d02",
"metadata": {},
Expand Down Expand Up @@ -411,9 +402,74 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "289724c8",
"id": "0f3ccb75",
"metadata": {},
"source": [
"## Migrating dataset from \"emtpy\" workspaces\n",
"\n",
"For old argilla versions, datasets could be created with no workspace inf (`-` workspace in UI). New versions expect to work with datasets in a given workspace.\n",
"\n",
"If you have datasets within an empty workspaces, you should move them to a specific workspace to keep your workflow compatible with the latest versions\n",
"\n",
"<div class=\"alert alert-warning\">\n",
"\n",
"Warning\n",
"\n",
"From argilla version v1.4.0, datasets with empty workspace won't be supported anymore, and you should migrate them before upgrading argilla.\n",
"\n",
"</div>"
]
},
{
"cell_type": "markdown",
"id": "b758c202-4b4c-4275-8aa8-047539ea2df0",
"metadata": {},
"source": [
"Here is a code snippet showing how to do it"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "360b0075",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"outputs": [],
"source": [
"import argilla as rg\n",
"from argilla.client import api\n",
"\n",
"rg.init()\n",
"rg_client = api.active_client()\n",
"\n",
"new_workspace = \"<put-target-workspace-here>\"\n",
"\n",
"empty_workspace_datasets = [\n",
" ds[\"name\"]\n",
" for ds in rg_client.http_client.get(\"/api/datasets\")\n",
" if not ds.get(\"owner\", None) # filtering dataset with no workspace (owner field)\n",
"]\n",
"\n",
"rg.set_workspace(\"\") # working from the \"empty\" workspace\n",
"\n",
"for dataset in empty_workspace_datasets:\n",
" rg.copy(dataset, dataset, new_workspace)\n",
"\n",
"# Dataset are normally copied to the provided workspace\n",
"# You should delete datasets with no workspace\n",
"# In that case, uncomment following lines\n",
"# for dataset in empty_workspace_datasets:\n",
"# rg.delete(dataset)"
]
},
{
"cell_type": "markdown",
"id": "6f945b5c",
"metadata": {},
"source": [
"## Reindex a Dataset\n",
Expand All @@ -422,7 +478,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "aa5a3998",
"metadata": {},
Expand All @@ -447,7 +502,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f92935ce",
"metadata": {},
Expand All @@ -473,7 +527,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "eb290a71-ad07-496f-b167-ad80d91fa633",
"metadata": {},
Expand Down Expand Up @@ -531,7 +584,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f2d5b02c-a24c-40d0-80ce-6332fba15318",
"metadata": {},
Expand All @@ -543,7 +595,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f6ae027b",
"metadata": {},
Expand Down Expand Up @@ -597,7 +648,6 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "907714da-5496-4a49-bc6d-2d9008d0082f",
"metadata": {},
Expand Down Expand Up @@ -646,7 +696,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "argilla",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -660,7 +710,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.15 | packaged by conda-forge | (main, Nov 22 2022, 08:50:29) \n[Clang 14.0.6 ]"
"version": "3.7.12"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit d0f8882

Please sign in to comment.