Run App Locally

Run an app locally

A tutorial for running an app locally with Nextmv Platform.

A run is a single execution of an app. It is the basic functionality encompassed of receiving an input, running the app, and returning an output. This tutorial will walk you through running an app locally on your machine.

  • Custom apps: given you control the code, you can test it locally before deploying it to Nextmv Cloud.
  • Subscription apps: test a subscription app locally by using the community app it is based on. This is a good way to get started in the path to customization.

The following languages are supported:

  • Go: using the Nextmv Go SDK.
  • Java: using native Java.
  • Python: using native Python.

Go

We offer the Go SDK for hosting API definitions for components such as the nextroute vehicle routing solver. The implementation is distributed with plugins. The Nextmv CLI takes care of handling the plugins and connecting to the API.

Make sure that the local assets are up to date by running:

nextmv sdk install
Copy

When working with Go projects, we recommend using the Nextmv CLI. Here are some examples of how to use the Nextmv CLI to run an app locally, from the app's root.

  • nextroute template. Learn more about vehicle routing here.
nextmv sdk run . -- -runner.input.path input.json -runner.output.path output.json -solve.duration 10s
Copy
  • mip template. Learn more about mixed integer programming here.
nextmv sdk run . -- -runner.input.path input.json -runner.output.path output.json -solve.duration 10s
Copy

Java

Use a Java installation.

Run the following command to generate a main.jar in the root directory of the project.

mvn package
Copy

For example, to run the knapsack community app, execute the main.jar file with the following command:

java -jar main.jar --input input.json --output output.json --duration 30
Copy

Python

Use a Python installation. We suggest you use a virtual environment (venv) as well.

Make sure that the requirements.txt are installed in that local venv.

pip3 install -r requirements.txt
Copy

Here are some examples of how to run an app locally, from the app's root.

  • ortools. Learn more about mixed integer programming here.
python3 main.py -input input.json -output output.json -duration 30
Copy
  • pyomo. Learn more about mixed integer programming here.
python3 main.py -input input.json -output output.json -duration 30 -provider cbc
Copy

Page last updated

Go to on-page nav menu