Run an execution with data from MIKE Cloud Platform
It is possible to use for engine execution data stored in MIKE Cloud Platform. In the following scenario project and appropriate datasets should be in MIKE Cloud Platform and can be created via MIKE Cloud Admin or MIKE Cloud Platform API.
Engine execution is performed in the context of the project which id is passed in dhi-project-id
header. If engine is executed at the highest level of the project all project structure with all datasets are replicated on the execution node. If that is not the required case, each model execution can have a folder/subfolder set to execute from.
For accessing data from subfolders it is important to set an extra header for engine execution:
"dhi-recursive-token": true
resultsRelativePath
. This path is relative to root project (the project in the context of which execution is started) or subprojectId
if specified. If resultsRelativePath
is left empty, execution results are uploaded to root project.
It is still possible to also pass a blob container url under the parameter output
. In this case outputs will also be saved in provided blob container.
Optional overwriteResultsIfExists
boolean parameter controls if existing platform files can be replaced with new uploaded result files.
When it is true
(default value), existing files will be replaced with the new uploaded result files.
When it is false
, files are not replaced and file names conflicts are resolved by adding a name suffix to uploaded result files.
Warning
When optional overwriteResultsIfExists
boolean parameter is not set, existing files stored in the platform results folder will be replaced with the new result files.
Simple execution¶
To run the engine, you need to upload data to MIKE Cloud Platform and specify the list of models to run. Each model has model name, engine and version as required parameter but also can be specified what subfolder to use. You also need to select pool type - different pool types offer different hardware configuration. All the hierarchy and files of the subfolder are replicated to the node. Example for the input using data from a root project:
{
"models": [
{
"modelFileName": "lake.m21fm",
"engine": "FemEngineHD",
"version": "2024.1",
"resultsRelativePath" : "Execution Results",
"overwriteResultsIfExists": true
}
],
"options": {
"poolType": "VM-S-5",
"nodeCount": 1
}
}
Click to show example shell script to run an engine execution that uses data from MIKE Cloud Platform
projectId="<replacewithprojectid>" openapikey="<replacewithopenapikey>" # create execution curl -L -X POST "https://api.mike-cloud-test.com/api/compute/execution/platform" \ -H 'api-version: 2' \ -H 'dhi-service-id: engine' \ -H "dhi-project-id: $projectId" \ -H "dhi-open-api-key: $openapikey" \ -H 'dhi-recursive-token: true' \ -H 'Content-Type: application/json' \ --data-raw '{ "models": [ { "modelFileName": "lake.m21fm", "engine": "FemEngineHD", "version": "2024.1", "resultsRelativePath" : "Execution Results", "overwriteResultsIfExists": true } ], "options": { "poolType": "VM-S-5", "nodeCount": 1 } }'
The list of versions is available in the response of /engine/list
endpoint.
Running multiple engines¶
Executing models from non flat hierarchies might require setting local path to the model file in the field modelFileName
. This local path is relative to subprojectId
or if skipped then root project. It is also relative path of the file on the node. Be careful not to override files. Adding multiple models will execute the engines in the listed order:
{
"models": [
{
"subprojectId": "<guid>",
"modelFileName": "FM Model/lake.m21fm",
"engine": "FemEngineHD",
"version": "2024.1",
"resultsRelativePath": "Execution Results/FM Model"
},
{
"subprojectId": "<guid>",
"modelFileName": "SW Model/Island.sw",
"engine": "FemEngineSW",
"version": "2024.1",
"resultsRelativePath": "Execution Results/SW Model"
}
],
"output": {
"uri": "https://engineoutput.blob.core.windows.net/thisismyoutputlocation"
},
"options": {
"poolType": "VM-S-5",
"nodeCount": 1
}
}
Click to show example shell script to run an engine execution with multiple engines that uses data from MIKE Cloud Platform
projectId="<replacewithprojectid>" openapikey="<replacewithopenapikey>" subprojectId = "<replacewithsubprojectid>" outputUrl = "<replacewithoutputurl>" # create execution curl -L -X POST "https://api.mike-cloud-test.com/api/compute/execution/platform" \ -H 'api-version: 2' \ -H 'dhi-service-id: engine' \ -H "dhi-project-id: $projectId" \ -H "dhi-open-api-key: $openapikey" \ -H 'dhi-recursive-token: true' \ -H 'Content-Type: application/json' \ --data-raw '{ "models": [ { "subprojectId": "$subprojectId", "modelFileName": "FM Model/lake.m21fm", "engine": "FemEngineHD", "version": "2024.1", "resultsRelativePath": "Execution Results/FM Model" }, { "subprojectId": "$subprojectId", "modelFileName": "SW Model/Island.sw", "engine": "FemEngineSW", "version": "2024.1", "resultsRelativePath": "Execution Results/SW Model" } ], "output": { "uri": "$outputUrl" }, "options": { "poolType": "VM-S-5", "nodeCount": 1 } }'
Run parameters¶
runParameters
are optional parameters used to run the engine. Read more about run parameters
{
"models": [
{
"subprojectId": "<guid>",
"modelFileName": "lake.m21fm",
"engine": "FemEngineHD",
"version": "2024.1",
"resultsRelativePath": "Execution Results/FM Model",
"runParameters": [
{
"name": "SubdomainsPerNode",
"value": "2"
},
{
"name": "ThreadsPerSubdomain",
"value": "1"
}
]
}
],
"output": {
"uri": "https://engineoutput.blob.core.windows.net/thisismyoutputlocation"
},
"options": {
"poolType": "VM-S-5",
"nodeCount": 1
}
}
Click to show example shell script to run an engine execution with run parameters options that uses data from MIKE Cloud Platform
projectId="<replacewithprojectid>" openapikey="<replacewithopenapikey>" subprojectId = "<replacewithsubprojectid>" outputUrl = "<replacewithoutputurl>" # create execution curl -L -X POST "https://api.mike-cloud-test.com/api/compute/execution/platform" \ -H 'api-version: 2' \ -H 'dhi-service-id: engine' \ -H "dhi-project-id: $projectId" \ -H "dhi-open-api-key: $openapikey" \ -H 'dhi-recursive-token: true' \ -H 'Content-Type: application/json' \ --data-raw '{ "models": [ { "subprojectId": "$subprojectId", "modelFileName": "lake.m21fm", "engine": "FemEngineHD", "version": "2024.1", "resultsRelativePath": "Execution Results/FM Model", "runParameters": [ { "name": "SubdomainsPerNode", "value": "2" }, { "name": "ThreadsPerSubdomain", "value": "1" } ] } ], "output": { "uri": "$outputUrl" }, "options": { "poolType": "VM-S-5", "nodeCount": 1 } }'