One of the main features of nextmv
, the general Nextmv Python SDK, is the ability to interact with the Nextmv Cloud. This allows you to run, and experiment with your decision applications in Cloud.
Before starting:
- Sign up for a Nextmv account.
- Get your API key. Go to Team > API Key.
Make sure that you have your API key set as an environment variable:
Once you have your API key set up, you can create a cloud Client
:
Application
An application represents a decision model that you can run in the Nextmv Cloud. The Application
class defines the methods to interact with an app. You can create an app in multiple ways:
- Through the Python SDK (see next header).
- Through the Nextmv CLI.
- Through the Nextmv Cloud Console.
Once you have an app, and can identify its ID, you can interact with it.
Create an app
You can create an app by providing the Client
instance and the app ID:
Delete an app
You can delete an application by using its ID.
Push to an app
There are two strategies to push an application to the Nextmv Cloud:
Specifying
app_dir
, which is the path to an app’s root directory. This acts as an external strategy, where the app is composed of files in a directory and those apps are packaged and pushed to Nextmv Cloud. This is language-agnostic and can work for an app written in any language.Place the following script in the root of your app directory and run it to push your app to the Nextmv Cloud. This is equivalent to using the Nextmv CLI and running
nextmv app push
.Specifying a
model
andmodel_configuration
. This acts as an internal (or Python-native) strategy called "Apps from Models", where an app is created from a model. The model is encoded, some dependencies and accompanying files are packaged, and the app is pushed to Nextmv Cloud.To push a
nextmv.Model
to Nextmv Cloud, you need optional dependencies. You can install them by running:Once all the optional dependencies are installed, you can push the app to Nextmv Cloud.
Run an app
Make a run and get the results.
Do more
Make sure to check out the latest version of nextmv
to see all the available features of the Application
. Here are some of the methods you can use that were not covered in this guide:
acceptance_test
: gets an acceptance test.batch_experiment
: gets a batch experiment.cancel_run
: cancels a run.delete_batch_experiment
: deletes a batch experiment.delete_acceptance_test
: deletes an acceptance test.input_set
: gets an input set.instance
: gets an instance.list_acceptance_tests
: lists acceptance tests.list_batch_experiments
: lists batch experiments.list_input_sets
: lists input sets.list_instances
: lists instances.list_versions
: lists versions.new_acceptance_test
: creates a new acceptance test.new_acceptance_test_with_result
: creates a new acceptance test and gets the result.new_batch_experiment
: creates a new batch experiment.new_input_set
: creates a new input set.new_version
: creates a new version.new_instance
: creates a new instance.run_input
: gets the input of a run.run_logs
: gets the logs of a run.run_metadata
: gets the metadata of a run.run_result
: gets the result of a run.run_result_with_polling
: gets the result of a run with polling.update_instance
: updates an instance.upload_large_input
: uploads a large input.upload_url
: gets the URL for uploading.version
: gets a version.