sam - 24leesten/SimU-Wiki GitHub Wiki

Simulation Application Manager (SAM)

The Simulation Application Manager is typically contained on a remote server (though this is not necessary). It holds the Applications and runs them upon request form the Master Execution Controller (MEC). Communication between the SAM and the MEC is accomplished via the Simulation Management Protocol (SMP). Within the SAM there are many pieces that help it to run simulations and return the results that the user might desire.

Structure

The SAM has a simple file structure. In it there are two main folders called executions and packages. There is also the python executable that starts the SAM listening for requests from the MEC called sam.py:

sam
├── packages
├── executions
└── sam.py

packages

The packages folder contains everything required to run a simulation. It is structured by putting each package into a folder named after the UUID that identifies the package. Inside that folder is an assets directory where any files that are required for the application to be run should be placed. There is also an application file which is an executable without an extension and a sim.cfg file.

sam
├── packages
│   ├── d5980e92-875c-4dd9-8b3f-715a364ce060
│   │   ├── assets
│   │   ├── application  # This is the executable for your simulation
│   │   └── sim.cfg
├── runs
└── sam.py
assets

The assets folder contains any files, such as libraries or data files, that might be needed at some point in the process of running the application and sending results to the MEC. Any files in this directory will be available in the working directory when the application is run.

Example: If the results of a simulation is a html string. You may want a css file that renders the html in a nice way. That css would be stored in the assets folder so that you could later tell the SAM to send it back to the MEC with the html result.

application

When the SAM runs the application it will call this file. All that matters is that this file is some sort of executable without the extension at the end.

sim.cfg

This is a file that tells the SAM what to expect of the application when it gets run. It tells the SAM such things as what parameters should be sent from the MEC in order for the application to run correctly. It also tells the SAM if there is post-processing or pre-processing. The file is structured using json, more details can be found on the Simulation Configuration Format wiki page.

executions

The executions folder contains the working directories for simulation runs. Each working directory is named by its run id, and will only be saved if specified in the application configuration to do so. This allows for storing any necessary information for past runs.

sam.py

This is simply the executable for the SAM. to start it run the following command:

python sam.py

(Note that the SAM requires python 3.5 or above.)

Simulation Output Protocol (SOP)

The Simulation Output Protocol defines how an application should give output in order for the SAM to correctly parse it and send it back to the MEC. All output in this protocol is written to a file called OUTPUT.txt. It does this using json formatted strings written line by line for each string. As soon as one line is written the SAM parses that line and sends it to the MEC.

Protocols

Simulation Configuration Format
Simulation Management Protocol
Simulation Output Protocol