jataware / dojo-cli

A command-line interface to for black box model execution.
MIT License
0 stars 0 forks source link

dojo-cli

A command-line interface library for black box domain model execution. This library enables uses to execute domain models locally.

The library has 6 key methods:

Setup

The CLI requires a configuration file with Docker Hub and DOJO credentials. This filename can be passed with each CLI command via the --config option, or the default file .config will be used.

See example.config for guidance:

{
    "DOCKERHUB_USER": "",
    "DOCKERHUB_PWD": "",
    "DOJO_URL": "https://dojo-test.com",
    "DOJO_USER": "",
    "DOJO_PWD": ""
}

CLI help

python dojocli/cli.py --help
python dojocli/cli.py listmodels --help
python dojocli/cli.py printparams --help
python dojocli/cli.py runmodel --help

Available commands

listmodels

Description

List available models.

Parameters

Example

$ python dojocli/cli.py listmodels

(1) APSIM
(2) APSIM-Cropping
(3) APSIM-Rangelands
(4) Accessibility Model
(5) AgMIP Seasonal Crop Emulator
(6) CHIRPS - Climate Hazards Center Infrared Precipitation with Stations
(7) CHIRPS-GEFS
(8) CHIRPS-GEFS Monthly
(9) CHIRPS-Monthly
...

printparams

Description

Prints model run parameters and writes them as JSON to file.

Parameters

Example

$ python dojocli/cli.py printparams --model=CHIRPS-Monthly

This will print the parameters necessary to run the model CHIRPS-Monthly:

Model run parameters for CHIRPS-Monthly
#  month  : 01
#  year  : 2021
#  bounding_box : [[33.512234, 2.719907], [49.98171,16.501768]]

Additionally, printparams will write params_template.json with example model parameters:

{" month  ": "01", " year  ": "2021", " bounding_box ": "[[33.512234, 2.719907], [49.98171,16.501768]]"}

runmodel

Description

Runs the selected model used the specified model parameters.

Parameters

To run a model, the parameter values should either be assigned via the --params option , or a json file specified via the --paramsfile option. If neither parameter option is set, the --paramsfile filename params_template.json will be used.

Examples

(1) Run the CHIRPS-Monthly model using the default configuration settings in .config and model parameters in params_template.json:

(2) Run the CHIRPS-Monthly model using the default configuration settings in .config and model parameters in chirps-monthly.json:

(3) Run the CHIRPS-Monthly model using the default configuration settings in .config and specified model parameters: