Plugin Examples
Two complete examples showing how to build plugins from scratch. Make sure you’ve read the Plugin Guide first.
Example 1: MPI Solver (No GUI)
Section titled “Example 1: MPI Solver (No GUI)”An MPI-based solver that runs in batch mode — version selection, file picking, conditional fields, MPI machinefile, environment variables, and pre/postprocess steps.
Step 1: Create the Plugin
Section titled “Step 1: Create the Plugin”Go to Admin > Plugins, click New Plugin, enter ID my-solver, and click Create.
Step 2: Basic Info Tab
Section titled “Step 2: Basic Info Tab”| Field | Value |
|---|---|
| Name | My Solver |
| Category | Simulation |
| Description | Run My Solver MPI jobs on the cluster |
| Plugin Version | 1.0.0 |
| Enabled | Leave off until configuration is complete |
Step 3: SLURM Tab
Section titled “Step 3: SLURM Tab”| Field | Value |
|---|---|
| Nodes | 1 |
| Tasks per Node | 4 |
| Memory | 8G |
| Exclusive | On |
Step 4: Execution Tab
Section titled “Step 4: Execution Tab”Machinefile Type: Select With Slots (OpenMPI format).
Environment Modules: Add openmpi/4.1.1.
Environment Variables: Add one entry:
| Key | Value | Enabled |
|---|---|---|
MY_SOLVER_LICENSE | [email protected] | On |
Preprocess: Add a step:
| Name | Command | Enabled |
|---|---|---|
| Copy input to scratch | cp "$input_file" /scratch/$SLURM_JOB_ID/ | On |
Postprocess: Add a step:
| Name | Command | Enabled |
|---|---|---|
| Copy results back | cp /scratch/$SLURM_JOB_ID/result.* . | On |
Step 5: Parameters Tab
Section titled “Step 5: Parameters Tab”Click Add Version Fields to auto-generate versions, version, and version_path. Then edit:
- versions default:
{"2.5": "/opt/mysolver/2.5/bin/solver", "2.4": "/opt/mysolver/2.4/bin/solver"} - version default:
2.5
Add these parameters:
input_file — Type: string, Widget: file, Extensions: ["inp", "dat"], Required: yes
num_iterations — Type: integer, Widget: number, Default: 1000, Minimum: 1, Maximum: 100000
precision — Type: string, Widget: radio, Default: double, Enum: ["single", "double"], enumLabels: {"single": "Single Precision (faster)", "double": "Double Precision (accurate)"}
Step 6: Script Tab
Section titled “Step 6: Script Tab”mpirun -np $SLURM_NTASKS -machinefile machinefile-$SLURM_JOB_ID \ "$version_path" -input "$input_file" -iter $num_iterations -prec "$precision"Step 7: Groups Tab
Section titled “Step 7: Groups Tab”Create two groups:
- Solver Options — fields:
version,precision,num_iterations - Input — fields:
input_file
Step 8: Preview and Save
Section titled “Step 8: Preview and Save”- Go to the Preview tab. Check Form Preview — you should see the version dropdown, precision radio buttons, iteration number field, and file picker.
- Fill in sample values and check Script Preview — verify the
mpiruncommand looks correct. - Click Save Plugin.
- Go to Basic Info tab, flip Enabled on, and save again.
Example 2: MATLAB (Optional VNC GUI)
Section titled “Example 2: MATLAB (Optional VNC GUI)”A plugin for MATLAB that can run .m scripts in batch mode or launch the interactive MATLAB desktop inside a VNC session. This mirrors the built-in MATLAB plugin.
Step 1: Create the Plugin
Section titled “Step 1: Create the Plugin”Go to Admin > Plugins, click New Plugin, enter ID my-matlab, and click Create.
Step 2: Basic Info Tab
Section titled “Step 2: Basic Info Tab”| Field | Value |
|---|---|
| Name | MATLAB |
| Category | Data Analysis |
| Description | MathWorks MATLAB — batch scripts or interactive desktop |
| Plugin Version | 1.0.0 |
| Enabled | Leave off for now |
Step 3: SLURM Tab
Section titled “Step 3: SLURM Tab”| Field | Value |
|---|---|
| CPUs per Task | 2 |
| Memory | 4G |
Step 4: Execution Tab — Enable VNC GUI
Section titled “Step 4: Execution Tab — Enable VNC GUI”This is the key step:
- Under GUI Settings, check Enable VNC GUI.
- Set GUI Mode to Optional (user chooses).
This adds a “Run in GUI Desktop” checkbox to the submit form and makes a built-in gui variable available (true/false).
Step 5: Parameters Tab
Section titled “Step 5: Parameters Tab”Click Add Version Fields and edit:
- versions default:
{"R2024a": "/usr/local/MATLAB/R2024a/bin/matlab", "Default": "/usr/local/bin/matlab"} - version default:
R2024a
Add one more parameter:
script_path — Type: string, Widget: file, Extensions: ["m"], showIf: { "gui": false }, requiredIf: { "gui": false }
The showIf and requiredIf reference the built-in gui key. When the user checks “Run in GUI Desktop”, the script file field hides.
Step 6: Script Tab
Section titled “Step 6: Script Tab”if [ "$gui" = "true" ]; then "$version_path" -desktopelse "$version_path" -nodisplay -nodesktop -nosplash < "$script_path"fiStep 7: Groups Tab
Section titled “Step 7: Groups Tab”Create one group:
- MATLAB Options — fields:
version,script_path
Step 8: Preview and Save
Section titled “Step 8: Preview and Save”- Go to Preview > Form Preview. You should see the version dropdown and the script file picker.
- Check the Run in GUI Desktop checkbox. The script_path field should disappear.
- Switch to Script Preview — verify the
if/elseblock. - Click Save Plugin, then enable it.