-
Notifications
You must be signed in to change notification settings - Fork 1
Running anuga on an instance
This page describes how we run a TsuDAT simulation:
- How the UI starts a simulation
- Preparations on the server
- Preparations on the instance
- Simulating on the instance
- Returning results to the UI
Due to the history of development of the backend of TsuDAT, with multiple cloud environments used, the UI code should import one of the following modules:
run_tsudat_amazon.py
run_tsudat_local.py
run_tsudat_ncios.py
run_tsudat_nci.py
The _amazon suffix module is designed to start an Amazon AWS instance, the _local module will run a simulation locally, etc. The _ncios module runs an OpenStack instance, and is the only module that works, the others have not been maintained.
So the server code will do:
import run_tsudat_ncios as run_tsudat
and when the user wants to run a simulation will do:
(work_dir, raw_elevations, boundaries, meshes, polygons, gauges,
topographies, user_dir) = run_tsudat.make_tsudat_dir(TsuDATBase, user.username,
scenario.project.name,
scenario.name,
scenario.model_setup,
scenario.event.tsudat_id)
#
# more UI preparation code, including creation of a JSON data file 'json_file'
#
run_tsudat.run_tsudat(json_file)
Here, as elsewhere, we simplify the code slightly.
The above calls to make_tsudat_dir() and run_tsudat() are documented elsewhere. It is enough here to say that make_tsudat_dir() creates a working directory tree that will be populated with simulation data files.
run_tsudat() actually creates an instance that runs the simulation. When it starts the instance
Code on the instance consists of two parts. The first is the bootstrap code which is 'baked into' the instance image. This is designed as a minimal system that takes userdata supplied by the UI on instance start and