Command Templates

For security purposes, HEAppE enables the users to run only a pre-prepared set of so-called Command Templates. Each template defines a script or executable binary, that will be executed on a specific HPC cluster queue to which the template is assigned (any dependencies or third-party software it might require). There are generally two kinds of these templates:

../_images/cmdTemplates.png

Static Command Template

The command template contains the set of input parameters (parameters are exposed in the API) that will be passed to the executable script during the run-time. Thus, the users can execute pre-prepared command templates with the pre-defined set of input parameters. The actual value of each parameter (input from the user) can be different for each job submission. The following block presents the static command template configuration in the HEAppE Middleware part. In the HPC part, must exist the corresponding test script with one inputParam parameter located at ~/.key_scripts/test.sh.

Static command template is configurable via the HEAppE Management API endpoints. Please see the HEAppE Management API documentation for more information.

Configuration of the static command template also can be done by specifying the following objects at the seed.njson file:

Example of static command template definition in seed.njson.
  "CommandTemplates":[
    {
      "Id": 1,
      "Name": "TestTemplate",
      "Description": "TestTemplate",
      "Code": "TestTemplate",
      "ExecutableFile": "~/.key_scripts/test.sh",
      "CommandParameters": "%%{inputParam}",
      "PreparationScript": null,
      "ClusterNodeTypeId": 2,
      "IsGeneric": false,
      "IsEnabled": true
    }
  ],
  "CommandTemplateParameters": [
    {
      "Id": 1,
      "Identifier": "inputParam",
      "Query": "",
      "Description": "inputParam",
      "CommandTemplateId": 1,
      "IsVisible": true
    }
  ]

Generic Command Template

The Generic Command Template in HEAppE Middleware is designed to facilitate the prototyping and creation of new Static Command Templates. It allows users to execute a bash script with dynamically defined parameters at runtime.

The Generic Command Template is a flexible template that primarily exposes the userScriptPath parameter. Other parameters are defined in the bash script used by the template and are specified with #HEAPPE_PARAM. Users must be familiar with all input parameters defined in this bash script, which need to be specified when creating a job using the HEAppE API.

The main purpose of the Generic Command Template is to enable prototyping and debugging. Once a Generic Command Template is debugged, it can be converted into a static command template using methods provided in the HEAppE Management API.

The following block shows how to configure the Generic Command Template in the HEAppE Middleware. The HPC part must have the corresponding generic test script with parameters (like iterations and message) located at ~/.key_scripts/test_generic.sh.

To create a new Static Command Template based on the Generic one, use the HEAppE Management API endpoints. For more details, refer to the HEAppE Management API documentation.

Configuration can be done by specifying the following objects in the seed.njson file:

Example of generic command template definition in seed.njson.
  "CommandTemplates":[
    {
      "Id": 1,
      "Name": "GenericCommandTemplate",
      "Description": "Command template for generic job.",
      "Code": "GenericCommandTemplate",
      "ExecutableFile": "~/.key_scripts/generic.sh",
      "CommandParameters": "%%{userScriptPath} %%{userScriptParametres}",
      "PreparationScript": null,
      "ClusterNodeTypeId": 2,
      "IsGeneric": true,
      "IsEnabled": true
    }
  ],
  "CommandTemplateParameters": [
    {
      "Id": 1,
      "Identifier": "userScriptPath",
      "Query": "",
      "Description": "Path of the user script, to be executed via the generic job script",
      "CommandTemplateId": 1,
      "IsVisible": true
    },
    {
      "Id": 2,
      "Identifier": "userScriptParametres",
      "Query": "",
      "Description": "Generic parameters of the generic command template.",
      "CommandTemplateId": 1,
      "IsVisible": false
    }
  ]
Example of generic command template script located at ~/.key_scripts/test-generic.sh.
#!/bin/bash
#HEAPPE_PARAM iterations
#HEAPPE_PARAM message

echo "Input param: ${message}"
for i in $( eval echo "{0..${iterations}}" )
do
  echo "Iteration: ${i}"
  sleep 30s
done
echo "some result" >> resultFile.txt
exit 0