Run an execution with multiple setup files

In some cases it is required to run multiple setup files as part of the same execution (e.g., when the output of running a setup file will be used in running a second setup file). In this case all the setup files to be executed must be given as inputs to the engine execution, together with other files required by the setups. The order in which the setup files are specified in the input to engine execution is important, as it defines the order in which the setup files will be executed. E.g., in the following example which specifies two setup files (lake1.m21fm and lake2.m21fm) , lake1.m21fm will be executed first, followed by lake2.m21fm:

{
  "inputs": [
    {
      "uri": "https://coreenginedev0inputs.blob.core.windows.net/data/lake-seq/lake1.m21fm",
      "localPath": "lake1.m21fm",
      "engine": "FemEngineHD",
      "version": "2023.0"
    },
    {
      "uri": "https://coreenginedev0inputs.blob.core.windows.net/data/lake-seq/lake2.m21fm",
      "localPath": "lake2.m21fm",
      "engine": "FemEngineHD",
      "version": "2023.0"
    },
    {
      "uri": "https://coreenginedev0inputs.blob.core.windows.net/data/lake-seq/lake.mesh",
      "localPath": "lake.mesh"
    }
  ],
  "options": {
    "poolType": "VM-S-5",
    "nodeCount": 1
  }
}
Click to show example shell script to run an execution with multiple setup files

projectId="<replacewithprojectid>"
openapikey="<replacewithopenapikey>"

# create execution
curl -L -X POST "https://api.mike-cloud-test.com/api/compute/execution" \
  -H 'api-version: 2' \
  -H 'dhi-service-id: engine' \
  -H "dhi-project-id: $projectId" \
  -H "dhi-open-api-key: $openapikey" \
  -H 'Content-Type: application/json' \
  --data-raw '{
      "inputs": [
        {
          "uri": "https://coreenginedev0inputs.blob.core.windows.net/data/lake-seq/lake1.m21fm",
          "localPath": "lake1.m21fm",
          "engine": "FemEngineHD",
          "version": "2023.0"
        },
        {
          "uri": "https://coreenginedev0inputs.blob.core.windows.net/data/lake-seq/lake2.m21fm",
          "localPath": "lake2.m21fm",
          "engine": "FemEngineHD",
          "version": "2023.0"
        },
        {
          "uri": "https://coreenginedev0inputs.blob.core.windows.net/data/lake-seq/lake.mesh",
          "localPath": "lake.mesh"
        }
      ],
      "options": {
        "poolType": "VM-S-5",
        "nodeCount": 1
      }
    }'

The progress of the engine execution is reported by the RunningSetupIndex and the RunningSetupProgress properties. RunningSetupIndex is used to keep track of which setup file is currently executed, while RunningSetupProgress offers details regarding the progress of the currently executing setup. For Mike 21 RunningSetupProgress is based on the content of the .spi file generated by the engine during execution.

Assume we are running the example with lake1.m21fm and lake2.m21fm setup files. The following information about the execution shows that the second setup file (lake2.m21fm) is currently executed (runningSetupIndex equals 1) and the progress reported by the MIKE 21 engine for this setup is STATUS : 2004-01-01 02:21:00, MESSAG : Time step: 4230, COMSPD : 981736, PROGRE : 587, TIMLFT : 2:

{
    "executionId": "6a091d51-0f7d-4c60-b6ab-d42bf0a8e787",
    "outputLocation": "https://coreenginetestdata.blob.core.windows.net/6a091d51-0f7d-4c60-b6ab-d42bf0a8e787?sv=2018-03-28&sr=c&sig=phkMVZoQPbwe0oS57EYhWkp2v9EyJrZ%2Br%2FoS%2FYgKT%2Bk%3D&se=2020-09-26T08%3A01%3A20Z&sp=rl",
    "status": "InProgress",
    "message": null,
     ...
    "runningSetupIndex": 1,
    "runningSetupProgress": "STATUS : 2004-01-01 02:21:00, MESSAG : Time step: 4230, COMSPD : 981736, PROGRE : 587, TIMLFT : 2",
    "totalNumberOfSetups": 2
}

The TotalNumberOfSetups reports how many setup files will be run as part of the engine execution. In the above example TotalNumberOfSetups is 2, as we have two setup files (lake1.m21fm and lake2.m21fm).

Note

Please note that failure while running a setup file (e.g., due to a missing file) will not terminate the entire execution. The execution will continue, trying to run the remaining setup files specified in the input.