Skip to content

Commit

Permalink
Explain how to switch plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
louisdorard committed May 16, 2024
1 parent 485f25f commit 55438bd
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 9 deletions.
Binary file added docs/add_plugin_git.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 12 additions & 9 deletions docs/install-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@
* Make sure the "code env" feature is activated; if it's not, use the contents of the requirements file to create your first environment
* Enable maintenance access so that someone can install the plugin for you

## How to install

* TODO: instructions to install via Git
* Create the code environment for this plugin
* Select the types of containers you plan to use as backend for data editing webapps or for running recipes provided by the plugin. The easiest is to choose All. ![](add_plugin_creating_code_env.png)
* ![](add_plugin_creating_code_env_2.png)
* ![](add_plugin_creating_code_env_done.png)
* ![](add_plugin_creating_code_env_done_2.png)
* ![](add_plugin_done.png)
## How to install the plugin

* From the Plugins page of your Dataiku instance, click on the "Add Plugin" button in the top right corner and choose "Fetch from Git repository":
* Repository URL: `[email protected]:dataiku/dss-visual-edit.git`
* Development mode: leave unticked
* Checkout: `master`
* Path in repository: `dss-plugin-visual-edit`
* Create the code environment for this plugin. Select the types of containers you plan to use as backend for data editing webapps or for running recipes provided by the plugin (the easiest is to choose All).
* The plugin is installed! ![](plugin_installed.png) We'll see how to use each of its components in the next section.

## How to update the plugin

From the Plugins page of your Dataiku instance, go to the "Installed" tab, find "Visual Edit" in the list and click on the "Update from repository" link. ![](update_plugin_git.png)

## Next

Check out the guide to [Get started](get-started) for an introduction to the plugin's components and how to use them.
Binary file modified docs/plugin_installed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 59 additions & 0 deletions docs/switch-plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Switching to the `visual-edit` plugin

**Visual Edit** (plugin id `visual-edit`) is the public release of the previously private plugin **Data Editing** (plugin id `editable-via-webapp`). If you want your projects based on `editable-via-webapp` to switch to using `visual-edit`, follow the steps below:

1. [Install the `visual-edit` plugin](install-plugin) (keep `editable-via-webapp` for now)
2. Change the `project_key` variable in the code below
3. Create a bundle of your Dataiku project (to serve as backup if needed)
4. Run the code below as a script, or block by block in a notebook environment, either from Dataiku DSS or from your local Python environment (provided it has the `dataiku` package installed)
5. Repeat for all projects where you used `editable-via-webapp`. You can find a list of such projects at `/plugins/editable-via-webapp/usages/` in the Dataiku DSS web interface
6. Once you've done this for all projects, you can uninstall the `editable-via-webapp` plugin.

```python
# %%
# Initialize dataiku client and project
import dataiku

project_key = "ML_FEEDBACK_LOOP"
dss_client = dataiku.api_client()
project = dss_client.get_project(project_key)

# %%
# Delete plugin recipes
for recipe in project.list_recipes(as_type="objects"):
# print(recipe)
recipe_type = recipe.get_settings().type
if (
recipe_type == "CustomCode_merge-edits"
or recipe_type == "CustomCode_pivot-editlog"
):
recipe.delete()

# %%
# Rename all datasets ending with '_editlog_pivoted' to end with '_edits'
for d in project.list_datasets():
dataset_name = d["name"]
dataset = project.get_dataset(dataset_name)
# if the name ends with '_editlog_pivoted', rename it to change the suffix to '_edits'
if dataset_name.endswith("_editlog_pivoted"):
new_name = dataset_name.replace("_editlog_pivoted", "_edits")
# add to list of datasets to build
dataset.rename(new_name)
print(f"Renamed {dataset_name} to {new_name}")

# %%
# Stop visual webapps, change their types, and restart them: this re-creates the recipes we deleted but with the types from the new plugin
for webapp in project.list_webapps(as_type="objects"):
webapp_settings = webapp.get_settings()
if (
webapp_settings.get_raw()["type"]
== "webapp_editable-via-webapp_edit-dataset-records"
):
webapp.stop_backend()
webapp_settings.get_raw()["type"] = "webapp_visual-edit_visual-edit"
webapp_settings.save()
print(
f"Changed type of {webapp_settings.get_raw()['name']} to 'webapp_visual-edit_visual-edit'"
)
webapp.start_or_restart_backend()
```
Binary file added docs/update_plugin_git.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 55438bd

Please sign in to comment.