Import Resources#
This how-to explains how to import Dioptra Resources (e.g. Plugins, Entrypoints, Types) to a Dioptra deployment via an externally provided Resource Import TOML file.
Prerequisites#
Prepare Your Deployment - A deployment of Dioptra is required.
Set Up Dioptra in the GUI - Access Dioptra services in the GUI, create a user, and login.
Prepare Your Deployment - A deployment of Dioptra is required.
Set Up the Python Client - Connect to the Python Client in a Jupyter Notebook.
Resource Import Workflow#
Follow these steps to import resources (plugins, entrypoints, and types) into Dioptra.
Note
There are several name conflict resolution strategies for imported resources, which apply to all import options:
Fail - The import will fail if there is a name conflict.
Update - The previously registered resources will be updated with new definitions.
Overwrite - The previously registered resources will be deleted, and new resources will be created.
Step 1: Select the source to import from. (GUI only)#
Import resources from a Git repository.
In the Dioptra GUI, click the wrench symbol on the navigation bar. Select Import Resources from the drop down.
Select the either GIT REPO, UPLOAD ARCHIVE or UPLOAD DIRECTORY depending on where you would like to import resources from.
Select the access location for the resources:
For a Git repository:
Enter the URL to the branch of the Git repository containing the resources to import. (For example -
https://github.com/usnistgov/dioptra.git#main)For uploading an Archive:
Click Archive File Upload and select a tar file containing the files.
For uploading a Directory:
Click Directory Upload and select the directory containing the files.
Step 2: Import the Resources.#
Select a group to import these resources under.
Note
Dioptra does not currently support the creation of additional groups. All resources are under the same default public group.
Enter the path to the TOML file. (For example -
extra/dioptra.toml)Select a name conflict resolution strategy.
Select IMPORT.
Client Method:
Use the client to import the resources.
- WorkflowsCollectionClient.import_resources(group_id: int, source: str | dioptra.client.base.DioptraFile | list[dioptra.client.base.DioptraFile], config_path: str | None = None, resolve_name_conflicts_strategy: Optional[Literal['fail', 'update', 'overwrite']] = None)[source]#
Import resources from a archive file or git repository
- Parameters
group_id – The group to import resources into
source – The source to import from. Can be a str containing a git url, a DioptraFile containing an archive file or a list[DioptraFile] containing resource files.
config_path – The path to the toml configuration file in the import source. If None, the API will use “dioptra.toml” as the default. Defaults to None.
resolve_name_conflicts_strategy – The strategy for resolving name conflicts. Either “fail”, “update”, or “overwrite”. If None, the API will use “fail” as the default. Defaults to None.
- Raises
IllegalArgumentError – If more than one import source is provided or if no import source is provided.
See Also#
Resource Import Reference - More information on syntax requirements for the Resource Import file
Plugins Reference - More information on syntax requirements for Plugins
Entrypoints Reference - More information on syntax requirements for Entrypoints