The Nextmv Python SDK can be used to bring your own Python decision model to Nextmv and interact with the Nextmv Platform. The Python SDK formalizes common patterns to standardize model options, input, logging, output, and statistics.
Export your API key as an environment variable:
Complete run workflow
Execute the complete run workflow (submit a run, poll for status, get the results). The output
key will contain the actual output of the run. This is an aggregation of the other steps.
New run
Submit a new run. The run_id
is returned.
Run metadata
Get a run metadata. The metadata.status
key will contain the status of the run. Use the run_id
obtained from submitting a run.
Run result
Get a run result. The output
key will contain the actual output of the run. Use the run_id
obtained from submitting a run.
The app.run_result_with_polling
method is also available. It will poll for the run status and return the result when it is succeeded
.
Cancel a run
To cancel a run, use the cancel_run
method.
Account queue
Get the queue of runs for the account. A run is queued when the status_v2
in the metadata is queued
. Use the Account.queue
method.