The RiverSystem.Service.Cluster.dll and RiverSystem.Service.Cluster.Host.exe provides a mechanism to run many different servers without the Source interface . All the features of the Command Line Runner interface are available but the cluster has no ability to be used without external code being written. The Command Line Runner should be used for ad-hoc server creation and batch jobs. The cluster allows for automatically starting and stopping Command Line Runner server instances.
The RiverSystem.Service.Cluster.dll can be hosted in IIS. We also provide a simple self hosting executable called RiverSystem.Service.Cluster.Host.exe. Running this will start server with the default endpoint of
to specify the endpoint you can provide a parameter during startup
Code Block |
---|
RiverSystem.Service.Cluster.Host.exe http://somemachine.domain.com:8001/Source |
RiverSystem.Service.Cluster.Host.exe and
is includedRiverSystem.Service.Cluster.dll are included with Source.
The command line cluster is used in custom situations where you need to start and stop services on a remote machine:
- for custom development and customisation where running source in being automated
The cluster can only be used in a server configuration. Accessed it is impractical to run Source from the main user interface, such as:
- For batch runs, where Source is run many times with a range of different parameter values; or
- Optimisation scenarios; and
- When integrating Source with other models or business systems.
The command line can be used in either a standalone (in-process) mode or in a client/server configuration. When run in client/server mode, the Source project is loaded and run at the server side, with parameters provided by and results returned through the client. In this way, the server can be used for many runs of the same project, without needing to reload the project file each time.can automatically create new servers on the host machine to run source models and destroy them when they are completed.
All communication with the cluster are performed over http. The follow table outlines the calls that can me made. All calls addresses should be considered as appended to the base address of the service.
eg. if the service is hosted at http://localhost:8001/Source a call to the echo command would look like http://localhost:8001/Source/echo/AMessage and the result would return the string "You Typed: AMessage". This echo endpoint can be very useful to verify that the cluster server is up and responsive without changing any state on the server.
Items shown between curly braces are parameters that you would configure as part of the call.
Interface Address | Function | Example | |||||
---|---|---|---|---|---|---|---|
/echo/{message} | Address for server to create, or client to connect. | -a "net.pipe://localhost/PipeReverse" | |||||
/projectDirectory/{*projectDirectory} | Ignore units set within project and output base SI units | --baseSIUnits | |||||
/create | File to load state from when in client mode or file to save state in when in server mode. | -c "c:\StateFiles\state.txt" | |||||
/load?instance={instance}&project={projectName}&scenario={scenarioName} | Directory in which to look for projects. | -d "c:\ProjectFiles" | |||||
/saveas?instance={instance}&project={projectNewName}&folderPath={folderPath} | Operation timeout for WCF service in seconds. | -e 2000 | |||||
/units?instance={instance}&si={useSIUnits} | File to merge command-line settings from. | -f "settings.txt" | |||||
/project?instance={instance} | This option allows a plugin (that the project has been saved with) to be loaded for this run only. The path specified is a relative path to the plugin from the command line. eg. "Plugins\ExampleRainfallRunoffModel.dll" | -l "plugin.dll" | |||||
/run?instance={instance} | Application mode Client/Server/InProcess. | -m Client or -m Server | |||||
/step?instance={instance} | File to save output into. The extension selects the output format based on the standard TIME I/O formats. A directory of the name specified will be created if the format only supports a single time series. | -o "output.res.csv" for CSV or -o "output.nc" | |||||
/getStep?instance={instance} | Path to the project, or project name on server and optional scenario within that project, DateTime values to override the default start and end times of the loaded scenario and data source input set to run. | -p "projectName.rspr | |||||
/metaParameters?instance={instance} | Which results to return. This can appear multiple times.
| -r "someResult" -r "someOtherResult" | |||||
/metaParameter?instance={instance}&name={parameterName}&value={value} | Number of time-steps to run. | --step 1 | |||||
/allTimeSeries?instance={instance} | Reset the loaded project. | --reset | |||||
/timeSeries?instance={instance}&name={parameterName} | Return only the current time step's value for the specified results | --current | |||||
/timeStepValue?instance={instance}&name={parameterName} | Set the value of a Function (also called meta-parameter for calibration) | -v "$metaparam=25", or -v "$anotherMetaParam=2.3" | |||||
/reset?instance={instance} | Save the loaded project after the run is complete to the specified path and file. The string argument cannot be empty, and the path provided must be an existing directory and have saving permissions for the current user. | -y "C:\ProjectFiles\newProject.rsproj" | |||||
/finish?instance={instance} |