Skip to content

How to submit emulators to MINT

varunratnakar edited this page Jan 21, 2020 · 2 revisions
  1. Video: https://youtube.com/watch?v=y_l5J-z2jto
  2. Ensemble Manager OpenAPI spec: https://ensemble.mint.isi.edu/v1/api-docs
  3. Ingestion Manager OpenAPI spec: https://ingestion.mint.isi.edu/v1.2.0/openapi.json

1. Prepare an emulator payload

Example:

{
    "scenario": {
        "name": "Agriculture Modeling in Ethiopia",
        "regionid": "ethiopia",
        "time_period": {
            "from": "2017-01-01",
            "to": "2018-01-01"
        }
    },
    "subgoal": {
        "name": "Model Grain yield while varying planting start date in Oromia from Jun-Aug 2017",
        "indicatorid": "grain~dry__mass-per-area_yield",
        "interventionid": "crop__planting_start_time",
        "regionid": "w2L0D6WYOUmUfDeE7KpZ",
        "time_period": {
            "from": "2017-06-01",
            "to": "2017-08-30"
        }
    },
    "thread": {
        "modelid": "cycles-0.9.4-alpha-advanced-ethiopia-weather",
        "datasets": {
            "cycles_weather": "a325a2f9-2b3d-550c-8c7d-391d3cfea065"
        },
        "parameters": {
            "start_planting_day": [
                100, 107, 114
            ]
        }
    }
}

2. Submit a request to create a new emulator thread:

curl -X POST -H "Content-Type: application/json" -d @/path/to/emulator-payload.json https://ensemble.mint.isi.edu/v1/threads

Returns:

{"result":"success","message":"{\"scenario_id\":\"yPwu8HwZMnvgEI9ogiL4\",\"subgoal_id\":\"OfYrpWkVRkCu2bAXtVCD\",\"thread_id\":\"QSD1j9g3IwSQ2FW1ATdd\"}"}

3. Submit a request to execute the new emulator thread:

Use the message from above as the content of this request

curl -X POST -H "Content-Type: application/json" -d "{\"scenario_id\":\"B46nwKOrapiUoBP35Go0\",\"subgoal_id\":\"Rx22lqnlXwYLivm5OK3d\",\"thread_id\":\"Vz3LTGVndvaDuODoHbVk\"}" https://ensemble.mint.isi.edu/v1/executionsLocal

Returns:

{"result":"success","message":"Thread QSD1j9g3IwSQ2FW1ATdd submitted for execution !"}

4. Monitor emulator status:

curl "https://ensemble.mint.isi.edu/v1/monitors?scenario_id=B46nwKOrapiUoBP35Go0&thread_id=Vz3LTGVndvaDuODoHbVk"

Returns:

{"https://w3id.org/okn/i/mint/cycles-0.9.4-alpha-advanced-ethiopia-weather":{"successful_runs":78,"workflow_name":"","submission_time":1579625368325,"submitted_for_execution":true,"total_runs":78,"submitted_runs":78,"failed_runs":0}}

5. Create emulator summary:

curl -X POST -H "Content-Type: application/json" -d "{\"scenario_id\":\"yPwu8HwZMnvgEI9ogiL4\",\"subgoal_id\":\"OfYrpWkVRkCu2bAXtVCD\",\"thread_id\":\"QSD1j9g3IwSQ2FW1ATdd\"}" https://ingestion.mint.isi.edu/v1.2.0/summary

Returns:

{
  "url": "https://ingestion.mint.isi.edu/data/QSD1j9g3IwSQ2FW1ATdd_export/summary.json"
}