Examples

Before running either of the examples you will have to install SIMBA. Both examples use a simple bash script to demonstrate the functionality.

application.sh:

#!/usr/bin/env bash

# BEGIN: Copyright 
# Copyright (C) 2024 Rector and Visitors of the University of Virginia 
# All rights reserved 
# END: Copyright 

# BEGIN: License 
# Licensed under the Apache License, Version 2.0 (the "License"); 
# you may not use this file except in compliance with the License. 
# You may obtain a copy of the License at 
#   http://www.apache.org/licenses/LICENSE-2.0 
# END: License 

STATUS=$(jq '.statusFile' $1 | tr -d '"')

OUT=$(dirname $1)/$(basename $1 .json).out

echo 'hostname:   ' $(hostname) > ${OUT}

echo 'mode:       ' $(jq '.mode' $1) >> ${OUT}
echo 'currentTick: ' $(jq '.currentTick' $1) >> ${OUT}
echo 'currentTime: ' $(jq '.currentTime' $1) >> ${OUT}

echo '{"status": "success"}' > ${STATUS}

Local Example

This example can be executed without customization on any computer. To run this example execute:

examples/local/SIMBA.sh

It consist of two configuration files:

driver.json:

{
    "$schema": "https://raw.githubusercontent.com/NSSAC/SIMBA_driver/master/schema/driver.json",
    "initialTime" : "2024-01-01T00:00:00+00:00",
    "endTime" : "2024-01-01T03:30:00+00:00",
    "scheduleIntervals" : [
      {
        "endTick" : 6,
        "tickDuration" :  "PT600S"
      },
      {
        "endTick" : 100,
        "tickDuration" :  "PT1800S"
      },
      {
        "tickDuration" :  "PT3600S"
      }
    ]
  }

schedule.json:

{
  "$schema": "https://raw.githubusercontent.com/NSSAC/SIMBA_driver/master/schema/schedule.json",
  "schedule": [
    {
      "name": "SlurmModule1",
      "command": "../bin/application.sh",
      "priority": "Infinity",
      "updateCommonData": true,
      "startTick": 0,
      "tickIncrement": 1,
      "moduleData": {
        "mode": "preStep"
      },
      "type": "local"
    },
    {
      "name": "SlurmModule2",
      "command": "../bin/application.sh",
      "priority": 10,
      "startTick": 0,
      "tickIncrement": 2,
      "type": "local"
    }
  ],
  "commonData": {
    "dbHost": "128.164.3.12"
  }
}

Slurm Example

In order to execute this example the slurm account, qos, and partition must be adjusted in schedule.json and SIMBA.sbatch. After the adjustment please execute the example with:

examples/local/SIMBA.sh

driver.json:

{
    "$schema": "https://raw.githubusercontent.com/NSSAC/SIMBA_driver/master/schema/driver.json",
    "initialTime" : "2024-01-01T00:00:00+00:00",
    "endTime" : "2024-01-01T03:30:00+00:00",
    "scheduleIntervals" : [
      {
        "endTick" : 6,
        "tickDuration" :  "PT600S"
      },
      {
        "endTick" : 100,
        "tickDuration" :  "PT1800S"
      },
      {
        "tickDuration" :  "PT3600S"
      }
    ]
  }

schedule.json:

{
  "$schema": "https://raw.githubusercontent.com/NSSAC/SIMBA_driver/master/schema/schedule.json",
  "schedule": [
    {
      "name": "SlurmModule1",
      "command": "../bin/application.sh",
      "priority": "Infinity",
      "updateCommonData": true,
      "startTick": 0,
      "tickIncrement": 1,
      "moduleData": {
        "mode": "preStep"
      },
      "type": "parsl",
      "executor": {
        "type": "HighThroughputExecutor",
        "label": "slurm"
      },
      "provider": {
        "type": "SlurmProvider",
        "nodes_per_block": 1,
        "cores_per_node": 1,
        "init_blocks": 1,
        "account": "nssac_covid19",
        "qos": "bii-half",
        "partition": "bii",
        "exclusive": false
      }
    },
    {
      "name": "SlurmModule2",
      "command": "../bin/application.sh",
      "priority": 10,
      "startTick": 0,
      "tickIncrement": 2,
      "type": "parsl",
      "executor": {
        "type": "HighThroughputExecutor",
        "label": "slurm"
      },
      "provider": {
        "type": "SlurmProvider",
        "nodes_per_block": 1,
        "cores_per_node": 1,
        "init_blocks": 1,
        "account": "nssac_covid19",
        "qos": "bii-half",
        "partition": "bii",
        "exclusive": false
      }
    }
  ],
  "commonData": {
    "dbHost": "128.164.3.12"
  }
}

SIMBA.sbatch:

#!/bin/bash

#SBATCH --job-name test
#SBATCH --time 1:00:00
#SBATCH --partition bii
#SBATCH --qos bii-half
#SBATCH --account nssac_covid19
#SBATCH --nodes 1
#SBATCH --tasks-per-node 1

export PYTHONPATH=${SIMBA_PATH}:${PYTHONPATH}
${SIMBA_PATH}/bin/SIMBA.py ${SIMBA_PATH}/examples/slurm