method editor

This commit is contained in:
Alfredo Oliviero 2024-10-09 18:13:05 +02:00
parent ee77bbeaa7
commit 787d354c19
8 changed files with 165 additions and 0 deletions

View File

@ -1,2 +1,167 @@
# Method/Algorithm Importer
The **Method/Algorithm Importer** page allows users to create new computational methods or edit existing ones. When the page is opened, the form will be empty, providing the opportunity to define a new method. Alternatively, users can select an existing method from the **Methods List** to modify it.
The page is composed of several sections:
- **Methods List**: Displays all available methods categorized for easy navigation.
- **Method Editor**: The section where users can create or edit methods, define inputs, outputs, and specify execution scripts.
![Method Importer Overview](./imgs/analytics_engine_importer.png)
---
## **Methods List**
When the **Method/Algorithm Importer (CCP)** page is opened, the edit form will be empty by default, allowing users to create a new method. To edit an existing method, use the **Methods List** section on the left. Methods can be selected by:
- Clicking the **Edit** button ( ![edit button](./imgs/method_button_edit.png) ) next to a method to load it into the execution form.
- Dragging the method from the list and dropping it into the execution form.
---
## **Method Editor**
The **Method Editor** is where users can create new methods or edit existing ones. It consists of the following components:
### **Basic Information**
- **Title**: The name of the method.
- **Version**: The version number of the method.
- **Description**: A brief description of the method's purpose.
- **Keywords**: Tags to help categorize the method (e.g., "python", "wordcloud").
- **Categories**: The broader category the method belongs to.
- **Compatible Infrastructures**: Lists the infrastructures where the method can be executed.
## **Saving and Managing Methods**
Once the method is defined, users can:
- **Save** (Blue Save icon): Saves the current method configuration.
- **Clean** (Blue rubber icon): Clean the editing form.
- **Delete** (Red Trash icon): Delete the method.
Saved methods will appear in the **Methods List** .
---
### **Inputs**
Users can define the inputs required by the method. Each input is configurable, including:
- **ccpimage**: Specifies the runtime Docker image (e.g., python:3.9).
- **File inputs**: For specifying input files, such as CSV or text files.
- **Custom parameters**: For defining specific method parameters (e.g., width, height for image generation, blacklist, transparency, etc.).
- **ccpnote annotation**: Allows users to add a note for this method to help in identifying executions, improving traceability across multiple runs.
Each input can be added or removed using the **Add** (+) and **Remove** (Trash) buttons.
### **Defining a New Input**
By pressing the **Plus** button ![Plus Button](./imgs/edit_button_plus.png) in the **Inputs** section, the interface for defining a new input field is created.
![New Input Form](./imgs/edit_new_input.png)
The following fields can be configured for the new input:
- **Input Name**: The name of the input, used to identify this field within the method.
- **Input Label**: The label shoed in the execution interface for the field
- **Description**: A brief description of the input field, providing context about its purpose or expected data.
- **Type**: Wheter the input field is String or Enumerated
- **Min. count**: The minimum number of occurrences required for this input. 0 for not mandatory fields
- **Max. count**: The maximum number of occurrences allowed for this input
- **Read Only**: Marks the input as read-only, preventing modifications during execution configuration.
- **Format**: Specifies the type of data the input will accept.
- **Default Value**: The value that will be used as default if no input is provided during execution.
#### **String Inputs**
selecting *String* as type , The available options fo **Format** for enumerated types include:
- **None**: A text-based value.
- **Number**: Numeric input.
- **True/False**: Boolean value.
- **File**: File input (max 100l). The User will upload the file from the execution interface
- **Workspace File**: File from the workspace. The input field will require the url of a file shared in the workspace
- **Date**, **Time**, **Date Time**: Date or time inputs.
- **Geography**: Geospatial data. The execution interface will show a map to select the geografic data (geometries, points, paths). The data can be coded in WKT, GML or GeoJSON formats
- **Secret**: For sensitive information.
- **URL**: A web link input.
- **Code**: Input for programming code.
- **Mime Type**: Defines the expected media type for the input, such as `text/plain` or `application/json`.
#### **Enumeration Inputs**
When **Enumerated** is selected as the type, users must define a comma-separated list of options. The execution interface will then display these options as a list or a set of checkboxes for selection.
- **Format**: The available formats for enumerated types include:
- **single_choice**: Allows the user to select one option from the list.
- **multi_choice**: Allows the user to select multiple options from the list.
![Input enumerated](./imgs/edit_input_enumerated.png)
---
### **Outputs**
The **Outputs** section allows users to define the outputs that will be generated by the method. By default, this section is empty, but users can add standard or custom outputs by using the buttons available.
![Outputs Section](./imgs/edit_output.png)
- **Green Button**: Adds `stdout` (standard output) to capture all standard messages generated by the method during execution.
- **Red Button**: Adds `stderr` (standard error) to capture warnings and error messages generated during execution.
- **Blue Button**: Allows users to add a customized output. This can be used to define additional outputs beyond the standard `stdout` and `stderr`, such as processed files or custom result formats.
Each output can be removed by clicking the **Trash** icon next to the corresponding output field.
---
### **Scripts**
The **Scripts** section allows users to define the commands necessary for deploying and executing the method. The inputs provided in the form must be pre-processed based on their format before being used in these scripts.
Users can define commands to:
- **Deploy**: Configure the deployment process, such as decoding input files and setting up environments.
- **Execute**: Define the commands to run the method, incorporating input parameters and handling additional configurations parameters.
To reference input values in the scripts, placeholders enclosed in double curly braces (`{{ }}`) are used. For example, an input named `file` would be referenced as `{{file}}` in the script.
In the upcoming sections, we will discuss how to handle and process inputs in both the **Deploy** and **Execute** scripts. This includes ensuring that input data is correctly integrated into the method's execution.
By using placeholders, the scripts dynamically incorporate the values provided during the execution configuration, allowing for flexible and reusable methods.
![Method Editor](./imgs/edit_script.png)
---
### **Outputs**
The **Outputs** section allows users to define the outputs that will be generated by the method. By default, this section is empty, but users can add standard or custom outputs by using the buttons available.
![Outputs Section](./imgs/output_section.png)
- **Green Button**: Adds `stdout` (standard output) to capture all standard messages generated by the method during execution.
- **Red Button**: Adds `stderr` (standard error) to capture warnings and error messages generated during execution.
- **Blue Button**: Allows users to add a customized output. This can be used to define additional outputs beyond the standard `stdout` and `stderr`, such as processed files or custom result formats.
Each output can be removed by clicking the **Trash** icon next to the corresponding output field.
## **Deploy and Execute Scripts**
The **Deploy and Execute Scripts** allow users to configure method-specific scripts for deployment and execution.
- **Deploy**: Handles the setup process, such as decoding input files (e.g., `base64` decoding) and preparing the environment.
- **Execute**: Contains the commands to run the method, using the parameters and input files defined in the editor.
These scripts ensure that the method is correctly initialized and executed on the selected infrastructure.
![Scripts Section](./imgs/scripts_section.png)
---

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB