Nextmv CLI is a command line interface that you can use to interact with Nextmv.
To display more information about a command, use the help
command or one of the help global flags: --help
, -h
.
Available commands
Available commands and their corresponding subcommands. You can navigate to each section to learn more about the specific command.
Command | Description | Subcommands |
---|---|---|
activate | Activate nextmv CLI. | |
app | Manage and interact with applications you create. | create , delete , get , list , list-versions , promote , push , result , run , metadata |
completion | Generate auto-completion script for a specified shell. | bash , fish , powershell , zsh |
configure | Setup Nextmv CLI. | |
experiment | This command set is used to manage and run experiments. | batch , input-set |
go | Provides passthrough access to the packaged Go toolchain. | |
help | Display help. | |
marketplace | Commands to manage and interact with marketplace. | |
private | Manage and interact with the Nextmv private cloud environment. | bootstrap , configure , get-release , keys , list-releases |
sdk | Install dev tools, initialize optimization templates and run models locally | init , install , run |
update | Update Nextmv CLI. | |
version | Print the version of Nextmv CLI. |
Global Flags
Global flags that can be added to any command.
Flag | Description |
---|---|
-c , --config string | Full path to config file. |
-h , --help | Get help for command. |
-c
, --config
This flag instructs the command to use the config file that is passed to it instead of the standard configuration file created with nextmv configure
(though note that the existing configuration file is not modified in any way). Here is an example using the sdk run
command:
-h
, --help
This flag displays the help menu.
You can also display the help for the specified command or subcommand. Here is an example using the version
command:
activate
command
Note: Tokens auto-renew, and there is no longer an activation required to extend a token
If you receive an error message containing "Your token expired and couldn't be updated" it is advised to run the activate
command. In case of any questions or issues, please contact support.
app
command
The nextmv app
command set is used to manage and run custom decision applications.
You can push
new binaries to Nextmv Cloud and run
them remotely with Nextmv CLI or using the Nextmv Cloud REST API.
To display more information about a command, use the help
command or one of the help global flags: --help
, -h
.
Available app
subcommands
Command | Description | Flags |
---|---|---|
create | Creates a new application in your account | --app-id, --description, --name |
delete | Deletes an application | --app-id, --confirm |
get | Gets an application configured in your account | --app-id |
input | Gets an application run's input | --app-id, --run-id, --output |
instance | A subsuite of commands to manage the instances for your application | |
list | Lists the applications configured for your account | |
metadata | Gets the result metadata of an application run | --app-id, --output, --run-id |
promote | Promotes an application version | --app-id, --description, --name |
push | Pushes the current project to a cloud application | --app-id |
result | Gets the results of an application run | --app-id, --output, --run-id |
run | Runs an application instance configured in your account | --app-id, --default, --input, --instance, --options, --timeout, --wait |
update | Updates an application | --app-id, --description, --instance-id, --name |
version | A subsuite of commands to manage the versions for your application |
app create
subcommand
The create
subcommand creates a new application. An application represents a problem you are solving and contains things like executable binaries, versions, and instances to manage and run your application. (See Apps core concepts for more)
These are the available flags for the create
subcommand:
Flag | Description |
---|---|
-a , --app-id string | Required The id of the app. Must be unique within your account and can contain lower case letters, numbers, and dashes. The maximum length is 30 characters. |
-n , --name string | Required The name for the application. |
-d , --description string | Optional The description for the application. |
app delete
subcommand
The delete
subcommand deletes an application. When you delete an application all of the versions and instances are also deleted.
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application to delete. |
app get
subcommand
The get
subcommand gets the information related to an application.
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application to get. |
app input
subcommand
The input
subcommand gets the input for a given application run.
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application. |
-r , --run-id string | Required The id of the run. |
-o , --output string | Optional The output file to write. Stdout used if not specified. |
app list
subcommand
The list
subcommand lists all of the applications for your account.
app metadata
subcommand
The metadata
subcommand gets the metadata results for the application run specified. Results contain the output of the run, and metadata related to the execution.
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application for the run. |
-r , --run-id string | Required The id of the run. |
-o , --output string | Optional The output location to use. Stdout used if not specified. |
app promote
subcommand
The promote
subcommand creates a new version of an application from the last pushed binary, and assigns that version to the default instance. If you specify an instance ID, then the newly created version will be assigned to this instance and then this instance will be set as the app’s default instance (replacing the default instance if there was one prior). If the instance ID you specify does not exist, a new instance will be created using the specified ID (the name will be auto-generated), the newly created version assigned to the instance, and this newly created instance set as the app’s default instance.
Since the CLI is oriented towards the developer, remote runs made through the CLI that don't specify an instance will run the last pushed binary. (The default instance can be specified with the --default flag.)
Calls made to the Nextmv Cloud API endpoints that don’t specify an instance will run the binary specified in the default instance. (The last pushed binary can be specified in the API call with the reserved instance name devint
which designates the latest binary.)
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application to promote. |
-n , --name string | Optional The name to assign to the version. Set to the app name + a unique ID if not specified. |
-d , --description string | Optional The description for the version. |
-v , --version-id string | Optional The ID to assign to the version. Set to app ID + a unique ID if not specified. |
-i , --instance-id string | Optional The ID to assign to the default instance. Set to the app ID if not specified. |
app push
subcommand
You must be inside your project when running this command.
The push
subcommand updates the latest binary in the cloud with your local application build. You must run this from the directory containing your application project.
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application to push to. |
app result
subcommand
The result
subcommand gets the results for the application specified. Results contain the output of the run, and metadata related to the execution. If the run failed or is still in progress, then only metadata will be present in the results.
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application for the run. |
-r , --run-id string | Required The id of the run. |
-o , --output string | Optional The output file to write. Stdout used if not specified. |
app run
subcommand
The run
subcommand starts a run of an application.
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application to run. |
-i , --input string | Optional The input file to use (Stdin if not specified). |
-d , --input string | Optional Run the default instance. Runs the last pushed application binary if not specified. |
-w , --wait string | Optional Waits for the run to complete, and outputs results to stdout. |
-t , --timeout string | Optional The maximum time in seconds to poll for results (default 60 seconds). |
--instance string | Optional The id of the instance to use. |
-o , --options stringArray | Optional The options used in an app run. Format: --options "solver.time.limit=10s,other.key=value". |
app update
subcommand
The update
subcommand allows updating the mutable information on the specified application. The mutable information is limited to the name, description, and ID of the default instance. If the name, description, or default instance ID tag is undefined the corresponding value will not be updated.
Flag | Description |
---|---|
-a , --app-id string | Required The ID of the application to update. |
-d , --description string | Optional The application description. Will remain unchanged if not specified. |
-i , --instance-id string | Optional The default instance ID. Will remain unchanged if not specified. |
-n , --name string | Optional The application name. Will remain unchanged if not specified. |
app version
subcommand
The version
subsuite for the nextmv app
command set is used to directly and explicitly manage application versions. The default workflow for the nexmtmv app
command set handles most of the functionality of this subsuite implicitly.
Available commands for version
subsuite
Command | Description | Flags |
---|---|---|
version create | Creates a new version for your application | --app-id --version-id --name --description |
version delete | Deletes the specified application version. | --app-id --version-id --confirm |
version get | Gets the specified application version. | --app-id --version-id |
version list | Lists the versions for your application | --app-id |
version update | Updates information about an application version. | --app-id --version-id --name --description |
version create
The version create
subcommand creates a new application version with the underlying binary defined by the current active development instance (i.e. the latest binary pushed to the app)
Flag | Description |
---|---|
-a , --app-id string | Required The ID of the application to create a version for. |
-d , --description string | Optional The version description. |
-n , --name string | Optional The version name. Will be set to app name + unique id if not specified. |
-v , --version-id string | Optional The ID of the version to create. Must be unique within the application. Version ID will be generated automatically if this flag is unset. |
version delete
The version delete
subcommand deletes a specified version from your application. Note that the version cannot be deleted if there are any instances running it.
Flag | Description |
---|---|
-a , --app-id string | Required The application ID for the application to delete a version from. |
-v , --version-id string | Required The ID of the version to delete. |
--confirm boolean | Optional Set to skip prompt to delete. |
version get
The version get
subcommand gets the information related to an application version.
Flag | Description |
---|---|
-a , --app-id string | Required The application ID for the application to get a version from. |
-v , --version-id string | Required The ID of the version to get. |
version list
The version list
subcommand lists all of the versions for an application.
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application to list versions for. |
version update
The version update
subcommand allows updating the mutable information on the specified version of your application. The mutable information is limited to the name and description of the version. If either the name or description tag are undefined, the corresponding value will not be updated.
Flag | Description |
---|---|
-a , --app-id string | Required The ID of the application to update the version of. |
-v , --version-id string | Required The ID of the version to update. |
-d , --description string | Optional The version description. Will remain unchanged if not specified. |
-n , --name string | Optional The version name. Will remain unchanged if not specified. |
app instance
subcommand
The instance
subsuite for the nextmv app
command set is used to directly and explicitly manage application instances. The default workflow for the nexmtmv app
command set handles limited functionality from this subsuite implicitly.
Available commands for instance
subsuite
Command | Description | Flags |
---|---|---|
instance create | Creates a new instance for your application | --app-id --instance-id --version-id --name --description --options |
instance delete | Deletes the specified application instance. | --app-id --instance-id --confirm |
instance get | Gets the specified application instance. | --app-id --instance-id |
instance list | Lists the instances for your application | --app-id |
instance update | Updates information about an application instance. | --app-id --instance-id --version-id --name --description --options |
instance create
The instance create
subcommand creates a new application instance with the underlying version specified by user input.
Flag | Description |
---|---|
-a , --app-id string | Required The ID of the application to create an instance for. |
v , --version-id string | Required The ID of the underlying version to be used by the instance. |
-d , --description string | Optional The instance description. |
-n , --name string | Optional The instance name. Will be set to app name + unique id if not specified. |
-i , --instance-id string | Optional The ID of the instance to create. Must be unique within the application. Instance ID will be generated automatically if this flag is unset. |
-o , --options stringArray | Optional The options passed to the instance. Format: --options "solver.time.limit=10s,other.key=value". |
instance delete
The instance delete
subcommand deletes a specified instance from your application.
Flag | Description |
---|---|
-a , --app-id string | Required The application ID for the application to delete an instance from. |
-i , --instance-id string | Required The ID of the instance to delete. |
--confirm boolean | Optional Set to skip prompt to delete. |
instance get
The instance get
subcommand gets the information related to an application instance.
Flag | Description |
---|---|
-a , --app-id string | Required The application ID for the application to get an instance from. |
-i , --instance-id string | Required The ID of the instance to get. |
instance list
The instance list
subcommand lists all of the instances for an application.
Flag | Description |
---|---|
-a , --app-id string | Required The id of the application to list instances for. |
instance update
The instance update
subcommand allows updating the information on the specified instance of your application. The instance's name, description, and the ID of the underlying version it uses can be modified. If any of these values are not defined via flags, they will not be modified
Flag | Description |
---|---|
-a , --app-id string | Required The ID of the application to update the instance of. |
-i , --instance-id string | Required The ID of the instance to update. |
-v , --version-id string | Optional The ID of the underlying version the instance uses. Will remain unchanged if not specified. |
-d , --description string | Optional The instance description. Will remain unchanged if not specified. |
-n , --name string | Optional The instance name. Will remain unchanged if not specified. |
-o , --options stringArray | Optional The options passed to the instance. Format: --options "solver.time.limit=10s,other.key=value". |
completion
command
The completion
command generates the autocompletion script for the Nextmv CLI for the specified shell.
Here is an example on displaying the completion
for zsh
:
configure
command
The configure
command adds or modifies your Nextmv API key for use with the Nextmv CLI. Running this command will create a config.yaml
file (or modify it if already present) in the directory where your nextmv
binary is located. Note that the base API endpoint will be set automatically with the default value when you pass your API key with the --api-key
flag. This command is typically run once.
These are the available flags for the configure
command:
Flag | Description |
---|---|
-a , --api-key string | Nextmv API key. |
-s , --show | Prints the current configuration. |
Here is an example where the configure
command is used to update the Nextmv API key with an environment variable.
experiment
command
To try out experiments with Nextmv, you must have a Nextmv account and be signed up for a free trial or paid account. For questions, please contact Nextmv support.
Experiments are used to test the performance of your models by running and comparing the results of various models, or a single model with multiple inputs.. From the CLI, you can create input sets and start new experiments. Experiments are run remotely on Nextmv Cloud and accessible via the Nextmv console.
Below is a list of available CLI subcommands
Available Experiment Commands
Command | Description |
---|---|
batch | A subsuite of commands to start batch experiments |
input-set | A subsuite of commands to manage input sets |
shadow | Commands to manage shadow tests |
batch
Batch experiments are used to run a set of inputs against a number of application instances on Nextmv Cloud. The results are aggregated and made available to the user in the Nextmv console.
Command | Description | Flags |
---|---|---|
start | Start a batch experiment run. | --app-id, --experiment-id, --description, --name, --input-set-id, --instance-ids --option-sets |
result | Gets the result of a batch experiment run. | --app-id, --experiment-id, --output |
batch start
batch result
input-set
Input sets are used to define named inputs for a batch experiment that can be reused across experiments.
Command | Description | Flags |
---|---|---|
create | Create an input set from historic runs | --app-id, --name, --description, --input-set-id, --instance-id, --start-time, --end-time, --run-ids --limit |
list | List input sets | --app-id |
get | Show an input set | --app-id, --input-set-id |
update | Update an input set | --app-id, --input-set-id, --name, --description |
input-set create
input-set list
input-set get
input-set update
For more information use the --help
flags for each command.
shadow
A shadow test is an experiment that runs in the background and compares the results of a baseline instance against a candidate instance. When the shadow test has started, any run made on the baseline instance will trigger a run on the candidate instance using the same input and options. For more information see the shadow tests reference.
Command | Description | Flags |
---|---|---|
create | Creates a new shadow test. |
|
list | Gets a list of all shadow tests. |
|
result | Gets the result of a shadow test. |
|
runs | Gets the runs of a shadow test. |
|
start | Starts a shadow test. |
|
stop | Stops a shadow test. |
|
shadow create
shadow list
shadow result
shadow runs
shadow start
shadow stop
For more information use the --help
flags for each command.
go
command
The go
command provides a passthrough to the Nextmv-managed Go toolchain.
help
command
The help
command displays the main help menu.
You can use help
to display the help menu for any specified command or subcommand.
Here is an example where the help
command is used to display the help for the sdk run
command:
marketplace
command
The marketplace
command set is used to manage marketplace commands.
Available Marketplace Subcommands
Command | Description |
---|---|
app | A subsuite of commands to manage marketplace applications. |
subscription | A subsuite of commands to manage marketplace subscriptions |
marketplace app
subsuite
Available marketplace app
Subcommands
Command | Description |
---|---|
create | Creates a new marketplace application. |
get | Gets a marketplace application. |
list | Lists the marketplace applications. |
update | Updates a marketplace application. |
version | Commands to manage marketplace application versions. |
marketplace subscription
subsuite
Available marketplace subscription
Subcommands
Command | Description |
---|---|
create | Creates a new marketplace subscription. |
delete | Deletes a marketplace subscription. |
get | Gets a marketplace subscription. |
list | Lists the marketplace subscriptions. |
private
command
The private
command manages and interacts with the Nextmv private cloud environment.
These are the available subcommands of the private
command:
Subcommand | Description |
---|---|
bootstrap | Bootstrap the environment. Learn more here. |
configure | Configures the private cloud environment. Learn more here. |
get-release | Gets a private cloud release. Learn more here. |
keys | Keys commands. Learn more here. |
list-releases | Lists the available private cloud releases. Learn more here. |
bootstrap
subcommand
The bootstrap
subcommand bootstraps a new default admin configuration. A service url should be provided.
configure
subcommand
The configure
subcommand configures a private cloud environment.
These are the available flags for the private configure
command:
Flag | Description |
---|---|
-a , --apikey string | The API key used to make calls to the Nextmv private cloud. |
-e , --endpoint string | The host endpoint, e.g.: my.private.cloud.io:8402 . |
get-release
subcommand
The get-release
subcommand gets an installable release for a private deployment.
These are the available flags for the private get-release
command:
Flag | Description |
---|---|
-o , --output string | The directory to install to (default current). |
keys
subcommand
The keys
subcommand manages the private cloud keys.
These are the available subcommands of the nextmv private keys
command:
Subcommand | Description |
---|---|
create | Creates a new key. |
deactivate | Deactivates a key. |
list | List API keys info. |
reactivate | Reactivates a key. |
create
subcommand
The create
subcommand creates a new key for admin and non-admin (applications).
These are the available flags for the create
subcommand:
Flag | Description |
---|---|
-a , --admin | boolean |
-n , --name string | API key name. |
deactivate
subcommand
The deactivate
subcommand deactivates an enabled API key.
These are the available flags for the deactivate
command:
Flag | Description |
---|---|
-a , --admin | boolean |
-n , --name string | API key name. |
keys list
subcommand
The list
subcommand lists API keys info.
These are the available flags for the list
subcommand:
Flag | Description |
---|---|
-a , --all | All keys, including disabled ones. |
reactivate
subcommand
The reactivate
subcommand reactivates a disabled API key.
These are the available flags for the reactivate
subcommand:
Flag | Description |
---|---|
-a , --admin | boolean |
-n , --name string | API key name. |
list-releases
subcommand
The private list-releases
command lists releases for private cloud.
sdk
command
The sdk
command suite contains commands for downloading and using Nextmv plugins for local development.
These are the available subcommands for the sdk
command:
Subcommand | Description |
---|---|
init | Initialize a new Nextmv template. Learn more here. |
install | Installs Nextmv plugin dependencies. Learn more here |
run | Run app locally. Learn more here. |
init
subcommand
The init
subcommand initializes a new Nextmv template. A template is a ready-to-run application that solves a decision automation problem.
Available templates
Focus Area | Template | Description |
---|---|---|
vehicle routing | routing | Solves a vehicle routing problem (VRP), using the Nextmv Router Engine. The template includes a complete list of options that can easily be configured to solve most routing problems. |
cloud-routing | Solves a vehicle routing problem (VRP), using a different input structure than the template above that exposes constraints via the input file. | |
routing-matrix-input | A modeling kit for vehicle routing problems (VRP). This template shows how to use a custom matrix that is passed via an input file | |
measure-matrix | Serves as an input generator for the routing-matrix-input app. The generated input data includes matrices for distance and travel time | |
time-dependent-measure | Makes use of time dependent measures and applies different costs according to time. | |
unique-matrix-measure | Reduce input file size by limiting the stop matrix to just unique points. | |
clustering | cluster | Groups a set of data points into clusters, where each cluster is a collection of points that are similar to one another in some way. |
cluster-tsp | Creates a set of clusters equal to the number of vehicles, in a pre-processing step, then solves a TSP for each vehicle. | |
packing | knapsack | Maximizes the total value without exceeding the weight capacity of the knapsack, given a collection of items with a value and weight. |
mip-knapsack | Solves the knapsack problem using Mixed Integer Programming and the open-source solver HiGHS. | |
scheduling | shift-scheduling | Assigns one worker to each shift while maximizing worker happiness score and covering all shifts with as few workers as possible. |
pager-duty | Assigns users to shifts (days) for incident response on-call duty using input and output data structures compatible with PagerDuty API. | |
custom | new-app | Provides a skeleton with guidance on how to utilize store to create a completely custom model. |
puzzle | sudoku | Fills a 9x9 grid such that all columns and all 3x3 subgrids contain the numerals 1 through 9. |
allocation | mip-meal-allocation | Allocates meals (diets) to bunnies with the goal of maximizing their happiness through good diets and nutrition. This template uses the open-source solver HiGHS. |
For a more in depth understanding of how to use each of these templates, visit the SDK reference page.
These are the available flags for the init
subcommand:
Flag | Description |
---|---|
-d , --directory string | The directory in which to initialize the template. |
-t , --template string | The type of Nextmv template you wish to generate. |
Here is an example where the init
subcommand is used to generate the knapsack
template.
After initializing the template, you can use the tree
command to check the contents of the knapsack
dir:
install
subcommand
The install
subcommand downloads the latest version of the SDK shared object files (or the version specified, if given) and the Nextmv-managed Go executable for your architecture.
These are the available flags for the install
subcommand:
Flag | Description |
---|---|
-r , --root string | The GOROOT used. |
Here is an example where the install
subcommand is used to check that all the necessary files and the Nextmv-managed Go executable are already installed:
run
subcommand
- It is best practice to set a duration limit when running locally. Do this by passing the
-- -limits.duration
flag. You can read more about solver flags here. - When running a Nextmv application, if no input path is given, you may provide input via stdin.
The run
subcommand allows you to compile and run custom code consuming the Nextmv SDK.
These are the available flags for the run
subcommand:
Flag | Description |
---|---|
-d , --debug-flags | If set, this will insert -gcflags='all=-N -l' and -tags=debug to Go for debugging Nextmv applications. |
-r , --root string | The GOROOT used. |
Runner and solver options are passed using --
.
Here is an example where the sdk init
and sdk run
commands are used to run the routing
template. The input is read from the input.json
file and the output is saved to an output.json
file.
update
command
The update
command updates the Nextmv CLI. If the version is not specified, it will update to the latest one.
version
command
The version
command prints the Nextmv CLI version.
Runner and solver options
All applications are configurable through the following options.
- Runner options change how the runner outputs solutions. For instance,
-runner.output.solutions
default oflast
will only output the final improving solution in a decision automation model. - Solver options change how many states are allowed in a diagram, how many states it pulls from the search queue, termination criteria, and randomization.
Options can be configured as CLI flags or environment variables. To set an environment variable, convert its corresponding CLI flag to uppercase, replacing each period (.
) with an underscore (_
) and removing the leading dash (-
). For example:
-limits.solutions
is equivalent to LIMITS_SOLUTIONS
.
If both an environment variable and its corresponding CLI flag are defined, the CLI flag will overwrite the environment variable.
CLI Flag | Environment Variable | Default | Description |
---|---|---|---|
-runner.input.path string | RUNNER_INPUT_PATH | - | Path to input file. |
-runner.output.path string | RUNNER_OUTPUT_PATH | - | Path to which output file should be written. |
-runner.output.quiet | RUNNER_OUTPUT_QUIET | null | Only output solutions. |
-runner.output.solutions string | RUNNER_OUTPUT_SOLUTIONS | last | Solutions to display: all , last - |
-runner.output.stream | RUNNER_OUTPUT_STREAM | null | Stream the output. |
-runner.profile.cpu string | RUNNER_PROFILE_CPU | null | File for CPU profile. |
-runner.profile.memory string | RUNNER_PROFILE_MEMORY | null | File for memory profile. |
-diagram.expansion.limit int | DIAGRAM_EXPANSION_LIMIT | 0 | Diagram expansion limit. |
-diagram.width int | DIAGRAM_WIDTH | 10 | Diagram width. |
-limits.duration duration | LIMITS_DURATION | 168h | Time limit, e.g. 10ms . |
-limits.nodes int | LIMITS_NODES | model.MaxInt | Node limit. |
-limits.solutions int | LIMITS_SOLUTIONS | model.MaxInt | Solution limit. |
-pool.size int | POOL_SIZE | 0 | Pool size (only used by specific engines). |
-random.seed int | RANDOM_SEED | 0 | Random seed. |
-search.buffer int | SEARCH_BUFFER | 100 | Solution buffer (0 = none). |
Solver options are automatically marshaled into model output in the options
section of the JSON.
LIMITS_DURATION
should be set to a non-zero value in production i.e. 1h
or 1m30s
. Valid time units are as follows, according to time.ParseDuration from Go's standard library.
- ns (nanoseconds)
- us/µs (microseconds)
- ms (milliseconds)
- s (seconds)
- m (minutes)
- h (hours)
The POOL_SIZE
variable is only used by specific engines, e.g. the fleet engine. In the specific case of the fleet engine, the larger value of runtime.GOMAXPROCS(0) / 2
and 1
overrides the POOL_SIZE
default value.