nextmv 0.18.0__py3-none-any.whl → 1.0.0.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nextmv/__about__.py +1 -1
- nextmv/__entrypoint__.py +8 -13
- nextmv/__init__.py +53 -0
- nextmv/_serialization.py +96 -0
- nextmv/base_model.py +54 -9
- nextmv/cli/CONTRIBUTING.md +511 -0
- nextmv/cli/__init__.py +0 -0
- nextmv/cli/cloud/__init__.py +47 -0
- nextmv/cli/cloud/acceptance/__init__.py +27 -0
- nextmv/cli/cloud/acceptance/create.py +393 -0
- nextmv/cli/cloud/acceptance/delete.py +68 -0
- nextmv/cli/cloud/acceptance/get.py +104 -0
- nextmv/cli/cloud/acceptance/list.py +62 -0
- nextmv/cli/cloud/acceptance/update.py +95 -0
- nextmv/cli/cloud/account/__init__.py +28 -0
- nextmv/cli/cloud/account/create.py +83 -0
- nextmv/cli/cloud/account/delete.py +60 -0
- nextmv/cli/cloud/account/get.py +66 -0
- nextmv/cli/cloud/account/update.py +70 -0
- nextmv/cli/cloud/app/__init__.py +35 -0
- nextmv/cli/cloud/app/create.py +141 -0
- nextmv/cli/cloud/app/delete.py +58 -0
- nextmv/cli/cloud/app/exists.py +44 -0
- nextmv/cli/cloud/app/get.py +66 -0
- nextmv/cli/cloud/app/list.py +61 -0
- nextmv/cli/cloud/app/push.py +137 -0
- nextmv/cli/cloud/app/update.py +124 -0
- nextmv/cli/cloud/batch/__init__.py +29 -0
- nextmv/cli/cloud/batch/create.py +454 -0
- nextmv/cli/cloud/batch/delete.py +68 -0
- nextmv/cli/cloud/batch/get.py +104 -0
- nextmv/cli/cloud/batch/list.py +63 -0
- nextmv/cli/cloud/batch/metadata.py +66 -0
- nextmv/cli/cloud/batch/update.py +95 -0
- nextmv/cli/cloud/data/__init__.py +26 -0
- nextmv/cli/cloud/data/upload.py +162 -0
- nextmv/cli/cloud/ensemble/__init__.py +31 -0
- nextmv/cli/cloud/ensemble/create.py +414 -0
- nextmv/cli/cloud/ensemble/delete.py +67 -0
- nextmv/cli/cloud/ensemble/get.py +65 -0
- nextmv/cli/cloud/ensemble/update.py +103 -0
- nextmv/cli/cloud/input_set/__init__.py +30 -0
- nextmv/cli/cloud/input_set/create.py +170 -0
- nextmv/cli/cloud/input_set/get.py +63 -0
- nextmv/cli/cloud/input_set/list.py +63 -0
- nextmv/cli/cloud/input_set/update.py +123 -0
- nextmv/cli/cloud/instance/__init__.py +35 -0
- nextmv/cli/cloud/instance/create.py +290 -0
- nextmv/cli/cloud/instance/delete.py +62 -0
- nextmv/cli/cloud/instance/exists.py +39 -0
- nextmv/cli/cloud/instance/get.py +62 -0
- nextmv/cli/cloud/instance/list.py +60 -0
- nextmv/cli/cloud/instance/update.py +216 -0
- nextmv/cli/cloud/managed_input/__init__.py +31 -0
- nextmv/cli/cloud/managed_input/create.py +146 -0
- nextmv/cli/cloud/managed_input/delete.py +65 -0
- nextmv/cli/cloud/managed_input/get.py +63 -0
- nextmv/cli/cloud/managed_input/list.py +60 -0
- nextmv/cli/cloud/managed_input/update.py +97 -0
- nextmv/cli/cloud/run/__init__.py +37 -0
- nextmv/cli/cloud/run/cancel.py +37 -0
- nextmv/cli/cloud/run/create.py +530 -0
- nextmv/cli/cloud/run/get.py +199 -0
- nextmv/cli/cloud/run/input.py +86 -0
- nextmv/cli/cloud/run/list.py +80 -0
- nextmv/cli/cloud/run/logs.py +167 -0
- nextmv/cli/cloud/run/metadata.py +67 -0
- nextmv/cli/cloud/run/track.py +501 -0
- nextmv/cli/cloud/scenario/__init__.py +29 -0
- nextmv/cli/cloud/scenario/create.py +451 -0
- nextmv/cli/cloud/scenario/delete.py +65 -0
- nextmv/cli/cloud/scenario/get.py +102 -0
- nextmv/cli/cloud/scenario/list.py +63 -0
- nextmv/cli/cloud/scenario/metadata.py +67 -0
- nextmv/cli/cloud/scenario/update.py +93 -0
- nextmv/cli/cloud/secrets/__init__.py +33 -0
- nextmv/cli/cloud/secrets/create.py +206 -0
- nextmv/cli/cloud/secrets/delete.py +67 -0
- nextmv/cli/cloud/secrets/get.py +66 -0
- nextmv/cli/cloud/secrets/list.py +60 -0
- nextmv/cli/cloud/secrets/update.py +147 -0
- nextmv/cli/cloud/shadow/__init__.py +33 -0
- nextmv/cli/cloud/shadow/create.py +184 -0
- nextmv/cli/cloud/shadow/delete.py +68 -0
- nextmv/cli/cloud/shadow/get.py +61 -0
- nextmv/cli/cloud/shadow/list.py +63 -0
- nextmv/cli/cloud/shadow/metadata.py +66 -0
- nextmv/cli/cloud/shadow/start.py +43 -0
- nextmv/cli/cloud/shadow/stop.py +43 -0
- nextmv/cli/cloud/shadow/update.py +95 -0
- nextmv/cli/cloud/upload/__init__.py +22 -0
- nextmv/cli/cloud/upload/create.py +39 -0
- nextmv/cli/cloud/version/__init__.py +33 -0
- nextmv/cli/cloud/version/create.py +97 -0
- nextmv/cli/cloud/version/delete.py +62 -0
- nextmv/cli/cloud/version/exists.py +39 -0
- nextmv/cli/cloud/version/get.py +62 -0
- nextmv/cli/cloud/version/list.py +60 -0
- nextmv/cli/cloud/version/update.py +92 -0
- nextmv/cli/community/__init__.py +24 -0
- nextmv/cli/community/clone.py +270 -0
- nextmv/cli/community/list.py +265 -0
- nextmv/cli/configuration/__init__.py +23 -0
- nextmv/cli/configuration/config.py +195 -0
- nextmv/cli/configuration/create.py +94 -0
- nextmv/cli/configuration/delete.py +67 -0
- nextmv/cli/configuration/list.py +77 -0
- nextmv/cli/main.py +188 -0
- nextmv/cli/message.py +153 -0
- nextmv/cli/options.py +206 -0
- nextmv/cli/version.py +38 -0
- nextmv/cloud/__init__.py +71 -17
- nextmv/cloud/acceptance_test.py +757 -51
- nextmv/cloud/account.py +406 -17
- nextmv/cloud/application/__init__.py +957 -0
- nextmv/cloud/application/_acceptance.py +419 -0
- nextmv/cloud/application/_batch_scenario.py +860 -0
- nextmv/cloud/application/_ensemble.py +251 -0
- nextmv/cloud/application/_input_set.py +227 -0
- nextmv/cloud/application/_instance.py +289 -0
- nextmv/cloud/application/_managed_input.py +227 -0
- nextmv/cloud/application/_run.py +1393 -0
- nextmv/cloud/application/_secrets.py +294 -0
- nextmv/cloud/application/_shadow.py +314 -0
- nextmv/cloud/application/_utils.py +54 -0
- nextmv/cloud/application/_version.py +303 -0
- nextmv/cloud/assets.py +48 -0
- nextmv/cloud/batch_experiment.py +294 -33
- nextmv/cloud/client.py +307 -66
- nextmv/cloud/ensemble.py +247 -0
- nextmv/cloud/input_set.py +120 -2
- nextmv/cloud/instance.py +133 -8
- nextmv/cloud/integration.py +533 -0
- nextmv/cloud/package.py +168 -53
- nextmv/cloud/scenario.py +410 -0
- nextmv/cloud/secrets.py +234 -0
- nextmv/cloud/shadow.py +190 -0
- nextmv/cloud/url.py +73 -0
- nextmv/cloud/version.py +132 -4
- nextmv/default_app/.gitignore +1 -0
- nextmv/default_app/README.md +32 -0
- nextmv/default_app/app.yaml +12 -0
- nextmv/default_app/input.json +5 -0
- nextmv/default_app/main.py +37 -0
- nextmv/default_app/requirements.txt +2 -0
- nextmv/default_app/src/__init__.py +0 -0
- nextmv/default_app/src/visuals.py +36 -0
- nextmv/deprecated.py +47 -0
- nextmv/input.py +861 -90
- nextmv/local/__init__.py +5 -0
- nextmv/local/application.py +1251 -0
- nextmv/local/executor.py +1042 -0
- nextmv/local/geojson_handler.py +323 -0
- nextmv/local/local.py +97 -0
- nextmv/local/plotly_handler.py +61 -0
- nextmv/local/runner.py +274 -0
- nextmv/logger.py +80 -9
- nextmv/manifest.py +1466 -0
- nextmv/model.py +241 -66
- nextmv/options.py +708 -115
- nextmv/output.py +1301 -274
- nextmv/polling.py +325 -0
- nextmv/run.py +1702 -0
- nextmv/safe.py +145 -0
- nextmv/status.py +122 -0
- nextmv-1.0.0.dev2.dist-info/METADATA +311 -0
- nextmv-1.0.0.dev2.dist-info/RECORD +170 -0
- {nextmv-0.18.0.dist-info → nextmv-1.0.0.dev2.dist-info}/WHEEL +1 -1
- nextmv-1.0.0.dev2.dist-info/entry_points.txt +2 -0
- nextmv/cloud/application.py +0 -1405
- nextmv/cloud/manifest.py +0 -234
- nextmv/cloud/status.py +0 -29
- nextmv-0.18.0.dist-info/METADATA +0 -770
- nextmv-0.18.0.dist-info/RECORD +0 -25
- {nextmv-0.18.0.dist-info → nextmv-1.0.0.dev2.dist-info}/licenses/LICENSE +0 -0
nextmv-0.18.0.dist-info/METADATA
DELETED
|
@@ -1,770 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: nextmv
|
|
3
|
-
Version: 0.18.0
|
|
4
|
-
Summary: The all-purpose Python SDK for Nextmv
|
|
5
|
-
Project-URL: Homepage, https://www.nextmv.io
|
|
6
|
-
Project-URL: Documentation, https://www.nextmv.io/docs
|
|
7
|
-
Project-URL: Repository, https://github.com/nextmv-io/nextmv-py
|
|
8
|
-
Author-email: Nextmv <tech@nextmv.io>
|
|
9
|
-
Maintainer-email: Nextmv <tech@nextmv.io>
|
|
10
|
-
License: Apache License
|
|
11
|
-
Version 2.0, January 2004
|
|
12
|
-
http://www.apache.org/licenses/
|
|
13
|
-
|
|
14
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
15
|
-
|
|
16
|
-
1. Definitions.
|
|
17
|
-
|
|
18
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
19
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
20
|
-
|
|
21
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
22
|
-
the copyright owner that is granting the License.
|
|
23
|
-
|
|
24
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
25
|
-
other entities that control, are controlled by, or are under common
|
|
26
|
-
control with that entity. For the purposes of this definition,
|
|
27
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
28
|
-
direction or management of such entity, whether by contract or
|
|
29
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
30
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
31
|
-
|
|
32
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
33
|
-
exercising permissions granted by this License.
|
|
34
|
-
|
|
35
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
36
|
-
including but not limited to software source code, documentation
|
|
37
|
-
source, and configuration files.
|
|
38
|
-
|
|
39
|
-
"Object" form shall mean any form resulting from mechanical
|
|
40
|
-
transformation or translation of a Source form, including but
|
|
41
|
-
not limited to compiled object code, generated documentation,
|
|
42
|
-
and conversions to other media types.
|
|
43
|
-
|
|
44
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
45
|
-
Object form, made available under the License, as indicated by a
|
|
46
|
-
copyright notice that is included in or attached to the work
|
|
47
|
-
(an example is provided in the Appendix below).
|
|
48
|
-
|
|
49
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
50
|
-
form, that is based on (or derived from) the Work and for which the
|
|
51
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
52
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
53
|
-
of this License, Derivative Works shall not include works that remain
|
|
54
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
55
|
-
the Work and Derivative Works thereof.
|
|
56
|
-
|
|
57
|
-
"Contribution" shall mean any work of authorship, including
|
|
58
|
-
the original version of the Work and any modifications or additions
|
|
59
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
60
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
61
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
62
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
63
|
-
means any form of electronic, verbal, or written communication sent
|
|
64
|
-
to the Licensor or its representatives, including but not limited to
|
|
65
|
-
communication on electronic mailing lists, source code control systems,
|
|
66
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
67
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
68
|
-
excluding communication that is conspicuously marked or otherwise
|
|
69
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
70
|
-
|
|
71
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
72
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
73
|
-
subsequently incorporated within the Work.
|
|
74
|
-
|
|
75
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
76
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
77
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
78
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
79
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
80
|
-
Work and such Derivative Works in Source or Object form.
|
|
81
|
-
|
|
82
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
83
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
84
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
85
|
-
(except as stated in this section) patent license to make, have made,
|
|
86
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
87
|
-
where such license applies only to those patent claims licensable
|
|
88
|
-
by such Contributor that are necessarily infringed by their
|
|
89
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
90
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
91
|
-
institute patent litigation against any entity (including a
|
|
92
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
93
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
94
|
-
or contributory patent infringement, then any patent licenses
|
|
95
|
-
granted to You under this License for that Work shall terminate
|
|
96
|
-
as of the date such litigation is filed.
|
|
97
|
-
|
|
98
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
99
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
100
|
-
modifications, and in Source or Object form, provided that You
|
|
101
|
-
meet the following conditions:
|
|
102
|
-
|
|
103
|
-
(a) You must give any other recipients of the Work or
|
|
104
|
-
Derivative Works a copy of this License; and
|
|
105
|
-
|
|
106
|
-
(b) You must cause any modified files to carry prominent notices
|
|
107
|
-
stating that You changed the files; and
|
|
108
|
-
|
|
109
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
110
|
-
that You distribute, all copyright, patent, trademark, and
|
|
111
|
-
attribution notices from the Source form of the Work,
|
|
112
|
-
excluding those notices that do not pertain to any part of
|
|
113
|
-
the Derivative Works; and
|
|
114
|
-
|
|
115
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
116
|
-
distribution, then any Derivative Works that You distribute must
|
|
117
|
-
include a readable copy of the attribution notices contained
|
|
118
|
-
within such NOTICE file, excluding those notices that do not
|
|
119
|
-
pertain to any part of the Derivative Works, in at least one
|
|
120
|
-
of the following places: within a NOTICE text file distributed
|
|
121
|
-
as part of the Derivative Works; within the Source form or
|
|
122
|
-
documentation, if provided along with the Derivative Works; or,
|
|
123
|
-
within a display generated by the Derivative Works, if and
|
|
124
|
-
wherever such third-party notices normally appear. The contents
|
|
125
|
-
of the NOTICE file are for informational purposes only and
|
|
126
|
-
do not modify the License. You may add Your own attribution
|
|
127
|
-
notices within Derivative Works that You distribute, alongside
|
|
128
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
129
|
-
that such additional attribution notices cannot be construed
|
|
130
|
-
as modifying the License.
|
|
131
|
-
|
|
132
|
-
You may add Your own copyright statement to Your modifications and
|
|
133
|
-
may provide additional or different license terms and conditions
|
|
134
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
135
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
136
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
137
|
-
the conditions stated in this License.
|
|
138
|
-
|
|
139
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
140
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
141
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
142
|
-
this License, without any additional terms or conditions.
|
|
143
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
144
|
-
the terms of any separate license agreement you may have executed
|
|
145
|
-
with Licensor regarding such Contributions.
|
|
146
|
-
|
|
147
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
148
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
149
|
-
except as required for reasonable and customary use in describing the
|
|
150
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
151
|
-
|
|
152
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
153
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
154
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
155
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
156
|
-
implied, including, without limitation, any warranties or conditions
|
|
157
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
158
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
159
|
-
appropriateness of using or redistributing the Work and assume any
|
|
160
|
-
risks associated with Your exercise of permissions under this License.
|
|
161
|
-
|
|
162
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
163
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
164
|
-
unless required by applicable law (such as deliberate and grossly
|
|
165
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
166
|
-
liable to You for damages, including any direct, indirect, special,
|
|
167
|
-
incidental, or consequential damages of any character arising as a
|
|
168
|
-
result of this License or out of the use or inability to use the
|
|
169
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
170
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
171
|
-
other commercial damages or losses), even if such Contributor
|
|
172
|
-
has been advised of the possibility of such damages.
|
|
173
|
-
|
|
174
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
175
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
176
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
177
|
-
or other liability obligations and/or rights consistent with this
|
|
178
|
-
License. However, in accepting such obligations, You may act only
|
|
179
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
180
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
181
|
-
defend, and hold each Contributor harmless for any liability
|
|
182
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
183
|
-
of your accepting any such warranty or additional liability.
|
|
184
|
-
|
|
185
|
-
END OF TERMS AND CONDITIONS
|
|
186
|
-
|
|
187
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
188
|
-
|
|
189
|
-
To apply the Apache License to your work, attach the following
|
|
190
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
191
|
-
replaced with your own identifying information. (Don't include
|
|
192
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
193
|
-
comment syntax for the file format. We also recommend that a
|
|
194
|
-
file or class name and description of purpose be included on the
|
|
195
|
-
same "printed page" as the copyright notice for easier
|
|
196
|
-
identification within third-party archives.
|
|
197
|
-
|
|
198
|
-
Copyright 2022-2023 nextmv.io inc.
|
|
199
|
-
|
|
200
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
201
|
-
you may not use this file except in compliance with the License.
|
|
202
|
-
You may obtain a copy of the License at
|
|
203
|
-
|
|
204
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
205
|
-
|
|
206
|
-
Unless required by applicable law or agreed to in writing, software
|
|
207
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
208
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
209
|
-
See the License for the specific language governing permissions and
|
|
210
|
-
limitations under the License.
|
|
211
|
-
License-File: LICENSE
|
|
212
|
-
Keywords: decision engineering,decision science,decisions,nextmv,operations research,optimization,shift scheduling,solver,vehicle routing problem
|
|
213
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
214
|
-
Classifier: Operating System :: OS Independent
|
|
215
|
-
Classifier: Programming Language :: Python :: 3
|
|
216
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
217
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
218
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
219
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
220
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
221
|
-
Requires-Python: >=3.9
|
|
222
|
-
Requires-Dist: pydantic>=2.5.2
|
|
223
|
-
Requires-Dist: pyyaml>=6.0.1
|
|
224
|
-
Requires-Dist: requests>=2.31.0
|
|
225
|
-
Requires-Dist: urllib3>=2.1.0
|
|
226
|
-
Provides-Extra: all
|
|
227
|
-
Requires-Dist: mlflow>=2.17.2; extra == 'all'
|
|
228
|
-
Description-Content-Type: text/markdown
|
|
229
|
-
|
|
230
|
-
# Nextmv Python SDK
|
|
231
|
-
|
|
232
|
-
Welcome to `nextmv`, the general Python SDK for the Nextmv Platform.
|
|
233
|
-
|
|
234
|
-
## Installation
|
|
235
|
-
|
|
236
|
-
Requires Python `>=3.9`. Install using `pip`:
|
|
237
|
-
|
|
238
|
-
```bash
|
|
239
|
-
pip install nextmv
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
Install all optional dependencies:
|
|
243
|
-
|
|
244
|
-
```bash
|
|
245
|
-
pip install "nextmv[all]"
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
## Usage
|
|
249
|
-
|
|
250
|
-
The Nextmv Python SDK is used to interact with various parts of the Nextmv
|
|
251
|
-
Platform:
|
|
252
|
-
|
|
253
|
-
- [Working with a Decision Model][working-with-a-decision-model]: Get to know
|
|
254
|
-
the functionality for running decision models. These API functions work
|
|
255
|
-
the same way in any machine (local or hosted).
|
|
256
|
-
- [Cloud][cloud]: Interact with the Nextmv Cloud API.
|
|
257
|
-
|
|
258
|
-
### Working with a Decision Model
|
|
259
|
-
|
|
260
|
-
To run a model, you can use the various helper functionality provided by the
|
|
261
|
-
SDK. Note that when you create an app that runs locally in your machine, it
|
|
262
|
-
will run in the same way in a Nextmv Cloud-hosted machine.
|
|
263
|
-
|
|
264
|
-
#### Options
|
|
265
|
-
|
|
266
|
-
Use options to capture parameters (i.e.: configurations) for the run:
|
|
267
|
-
|
|
268
|
-
```python
|
|
269
|
-
import nextmv
|
|
270
|
-
|
|
271
|
-
options = nextmv.Options(
|
|
272
|
-
nextmv.Parameter("str_option", str, "default value", "A string option", required=True),
|
|
273
|
-
nextmv.Parameter("int_option", int, 1, "An int option", required=False),
|
|
274
|
-
nextmv.Parameter("float_option", float, 1.0, "A float option", required=False),
|
|
275
|
-
nextmv.Parameter("bool_option", bool, True, "A bool option", required=True),
|
|
276
|
-
)
|
|
277
|
-
|
|
278
|
-
print(options.str_option)
|
|
279
|
-
print(options.int_option)
|
|
280
|
-
print(options.float_option)
|
|
281
|
-
print(options.bool_option)
|
|
282
|
-
print(options.to_dict())
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
By using options, you are able to pass in the values of the parameters with CLI
|
|
286
|
-
arguments or environment variables.
|
|
287
|
-
|
|
288
|
-
<!-- markdownlint-disable -->
|
|
289
|
-
|
|
290
|
-
```bash
|
|
291
|
-
$ python main.py --help
|
|
292
|
-
usage: main.py [options]
|
|
293
|
-
|
|
294
|
-
Options for main.py. Use command-line arguments (highest precedence) or environment variables.
|
|
295
|
-
|
|
296
|
-
optiTo exclude the `markdownlint` rule start and end block, you can use the
|
|
297
|
-
following syntax in your markdown file:STR_OPTION
|
|
298
|
-
[env var: STR_OPTION] (required) (default: default value) (type: str): A string option
|
|
299
|
-
-int_optRemember to replace `Your markdown content here` with your actual markdown
|
|
300
|
-
content.(type: int): An int option
|
|
301
|
-
-float_option FLOAT_OPTION, --float_option FLOAT_OPTION
|
|
302
|
-
[env var: FLOAT_OPTION] (default: 1.0) (type: float): A float option
|
|
303
|
-
-bool_option BOOL_OPTION, --bool_option BOOL_OPTION
|
|
304
|
-
[env var: BOOL_OPTION] (required) (default: True) (type: bool): A bool option
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
<!-- markdownlint-enable -->
|
|
308
|
-
|
|
309
|
-
#### Input
|
|
310
|
-
|
|
311
|
-
Capture the input data for the run.
|
|
312
|
-
|
|
313
|
-
- Work with `JSON`inputs.
|
|
314
|
-
|
|
315
|
-
```python
|
|
316
|
-
import nextmv
|
|
317
|
-
|
|
318
|
-
# Read JSON from stdin.
|
|
319
|
-
json_input_1 = nextmv.load_local()
|
|
320
|
-
print(json_input_1.data)
|
|
321
|
-
|
|
322
|
-
# Can also specify JSON format directly, and read from a file.
|
|
323
|
-
json_input_2 = nextmv.load_local(input_format=nextmv.InputFormat.JSON, path="input.json")
|
|
324
|
-
print(json_input_2.data)
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
- Work with plain, `utf-8` encoded, text inputs.
|
|
328
|
-
|
|
329
|
-
```python
|
|
330
|
-
import nextmv
|
|
331
|
-
|
|
332
|
-
# Read text from stdin.
|
|
333
|
-
text_input_1 = nextmv.load_local(input_format=nextmv.InputFormat.TEXT)
|
|
334
|
-
print(text_input_1.data)
|
|
335
|
-
|
|
336
|
-
# Can also read from a file.
|
|
337
|
-
text_input_2 = nextmv.load_local(input_format=nextmv.InputFormat.TEXT, path="input.txt")
|
|
338
|
-
print(text_input_2.data)
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
<!-- markdownlint-disable -->
|
|
342
|
-
|
|
343
|
-
- Work with multiple `CSV` files.
|
|
344
|
-
|
|
345
|
-
```python
|
|
346
|
-
import nextmv
|
|
347
|
-
|
|
348
|
-
# Read multiple CSV files from a dir named "input".
|
|
349
|
-
csv_archive_input_1 = nextmv.load_local(input_format=nextmv.InputFormat.CSV_ARCHIVE)
|
|
350
|
-
print(csv_archive_input_1.data)
|
|
351
|
-
|
|
352
|
-
# Read multiple CSV files from a custom dir.
|
|
353
|
-
csv_archive_input_2 = nextmv.load_local(input_format=nextmv.InputFormat.CSV_ARCHIVE, path="custom_dir")
|
|
354
|
-
print(csv_archive_input_2.data)
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
<!-- markdownlint-enable -->
|
|
358
|
-
|
|
359
|
-
#### Logging
|
|
360
|
-
|
|
361
|
-
The Nextmv platform captures logs via `stderr`. Use the provided functionality
|
|
362
|
-
to record logs.
|
|
363
|
-
|
|
364
|
-
```python
|
|
365
|
-
import sys
|
|
366
|
-
|
|
367
|
-
import nextmv
|
|
368
|
-
|
|
369
|
-
print("0. I do nothing")
|
|
370
|
-
|
|
371
|
-
nextmv.redirect_stdout()
|
|
372
|
-
|
|
373
|
-
nextmv.log("1. I log a message to stderr")
|
|
374
|
-
|
|
375
|
-
print("2. I print a message to stdout")
|
|
376
|
-
|
|
377
|
-
nextmv.reset_stdout()
|
|
378
|
-
|
|
379
|
-
print("3. I print another message to stdout")
|
|
380
|
-
|
|
381
|
-
print("4. I print yet another message to stderr without the logger", file=sys.stderr)
|
|
382
|
-
|
|
383
|
-
nextmv.log("5. I log a message to stderr using the nextmv module directly")
|
|
384
|
-
|
|
385
|
-
print("6. I print a message to stdout, again")
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
After executing it, here are the messages printed to the different streams.
|
|
389
|
-
|
|
390
|
-
- `stdout`
|
|
391
|
-
|
|
392
|
-
```txt
|
|
393
|
-
1. I do nothing
|
|
394
|
-
2. I print another message to stdout
|
|
395
|
-
3. I print a message to stdout, again
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
- `stderr`
|
|
399
|
-
|
|
400
|
-
```txt
|
|
401
|
-
1. I log a message to stderr
|
|
402
|
-
2. I print a message to stdout
|
|
403
|
-
3. I print yet another message to stderr without the logger
|
|
404
|
-
4. I log a message to stderr using the nextmv module directly
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
#### Output
|
|
408
|
-
|
|
409
|
-
Write the output data after a run is completed.
|
|
410
|
-
|
|
411
|
-
- Work with `JSON` outputs.
|
|
412
|
-
|
|
413
|
-
```python
|
|
414
|
-
import nextmv
|
|
415
|
-
|
|
416
|
-
output = nextmv.Output(
|
|
417
|
-
solution={"foo": "bar"},
|
|
418
|
-
statistics=nextmv.Statistics(
|
|
419
|
-
result=nextmv.ResultStatistics(
|
|
420
|
-
duration=1.0,
|
|
421
|
-
value=2.0,
|
|
422
|
-
custom={"custom": "result_value"},
|
|
423
|
-
),
|
|
424
|
-
run=nextmv.RunStatistics(
|
|
425
|
-
duration=3.0,
|
|
426
|
-
iterations=4,
|
|
427
|
-
custom={"custom": "run_value"},
|
|
428
|
-
),
|
|
429
|
-
),
|
|
430
|
-
)
|
|
431
|
-
|
|
432
|
-
# Write to stdout.
|
|
433
|
-
nextmv.write_local(output)
|
|
434
|
-
|
|
435
|
-
# Write to a file.
|
|
436
|
-
nextmv.write_local(output, path="output.json")
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
- Work with multple `CSV` files.
|
|
440
|
-
|
|
441
|
-
```python
|
|
442
|
-
import nextmv
|
|
443
|
-
|
|
444
|
-
output = nextmv.Output(
|
|
445
|
-
output_format=nextmv.OutputFormat.CSV_ARCHIVE,
|
|
446
|
-
solution={
|
|
447
|
-
"output": [
|
|
448
|
-
{"name": "Alice", "age": 30},
|
|
449
|
-
{"name": "Bob", "age": 40},
|
|
450
|
-
],
|
|
451
|
-
},
|
|
452
|
-
statistics=nextmv.Statistics(
|
|
453
|
-
result=nextmv.ResultStatistics(
|
|
454
|
-
duration=1.0,
|
|
455
|
-
value=2.0,
|
|
456
|
-
custom={"custom": "result_value"},
|
|
457
|
-
),
|
|
458
|
-
run=nextmv.RunStatistics(
|
|
459
|
-
duration=3.0,
|
|
460
|
-
iterations=4,
|
|
461
|
-
custom={"custom": "run_value"},
|
|
462
|
-
),
|
|
463
|
-
),
|
|
464
|
-
)
|
|
465
|
-
|
|
466
|
-
# Write multiple CSV fiules to a dir named "output".
|
|
467
|
-
nextmv.write_local(output)
|
|
468
|
-
|
|
469
|
-
# Write multiple CSV files to a custom dir.
|
|
470
|
-
nextmv.write_local(output, "custom_dir")
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
#### Model
|
|
474
|
-
|
|
475
|
-
A decision model is a program that makes decisions, i.e.: solves decision
|
|
476
|
-
problems. The model takes in an input (representing the problem data and
|
|
477
|
-
options) and returns an output, which is the solution to the decision problem.
|
|
478
|
-
The `nextmv.Model` class is the base class for all models. It holds the
|
|
479
|
-
necessary logic to handle all decisions.
|
|
480
|
-
|
|
481
|
-
When creating your own decision model, you must create a class that inherits
|
|
482
|
-
from `nextmv.Model` and implement the `solve` method.
|
|
483
|
-
|
|
484
|
-
```python
|
|
485
|
-
import nextmv
|
|
486
|
-
|
|
487
|
-
class YourCustomModel(nextmv.Model):
|
|
488
|
-
def solve(self, input: nextmv.Input) -> nextmv.Output:
|
|
489
|
-
"""Implement the logic to solve the decision problem here."""
|
|
490
|
-
pass
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
Here is an example of a simple knapsack problem, using `highspy` (HiGHS
|
|
494
|
-
open-source solver).
|
|
495
|
-
|
|
496
|
-
Consider the following input and options to configure the solver:
|
|
497
|
-
|
|
498
|
-
```python
|
|
499
|
-
import nextmv
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
sample_input = {
|
|
503
|
-
"items": [
|
|
504
|
-
{"id": "cat","value": 100,"weight": 20},
|
|
505
|
-
{"id": "dog","value": 20,"weight": 45},
|
|
506
|
-
{"id": "water","value": 40,"weight": 2},
|
|
507
|
-
{"id": "phone","value": 6,"weight": 1},
|
|
508
|
-
{"id": "book","value": 63,"weight": 10},
|
|
509
|
-
{"id": "rx","value": 81,"weight": 1},
|
|
510
|
-
{"id": "tablet","value": 28,"weight": 8},
|
|
511
|
-
{"id": "coat","value": 44,"weight": 9},
|
|
512
|
-
{"id": "laptop","value": 51,"weight": 13},
|
|
513
|
-
{"id": "keys","value": 92,"weight": 1},
|
|
514
|
-
{"id": "nuts","value": 18,"weight": 4}
|
|
515
|
-
],
|
|
516
|
-
"weight_capacity": 50
|
|
517
|
-
}
|
|
518
|
-
options = nextmv.Options(
|
|
519
|
-
nextmv.Parameter("duration", int, 30, "Max runtime duration (in seconds).", False),
|
|
520
|
-
)
|
|
521
|
-
```
|
|
522
|
-
|
|
523
|
-
You can define a `DecisionModel` that packs the knapsack with the most valuable
|
|
524
|
-
items without exceeding the weight capacity.
|
|
525
|
-
|
|
526
|
-
```python
|
|
527
|
-
import time
|
|
528
|
-
from importlib.metadata import version
|
|
529
|
-
|
|
530
|
-
import highspy
|
|
531
|
-
import nextmv
|
|
532
|
-
|
|
533
|
-
class DecisionModel(nextmv.Model):
|
|
534
|
-
def solve(self, input: nextmv.Input) -> nextmv.Output:
|
|
535
|
-
"""Solves the given problem and returns the solution."""
|
|
536
|
-
|
|
537
|
-
start_time = time.time()
|
|
538
|
-
|
|
539
|
-
# Creates the solver.
|
|
540
|
-
solver = highspy.Highs()
|
|
541
|
-
solver.silent() # Solver output ignores stdout redirect, silence it.
|
|
542
|
-
solver.setOptionValue("time_limit", input.options.duration)
|
|
543
|
-
|
|
544
|
-
# Initializes the linear sums.
|
|
545
|
-
weights = 0.0
|
|
546
|
-
values = 0.0
|
|
547
|
-
|
|
548
|
-
# Creates the decision variables and adds them to the linear sums.
|
|
549
|
-
items = []
|
|
550
|
-
for item in input.data["items"]:
|
|
551
|
-
item_variable = solver.addVariable(0.0, 1.0, item["value"])
|
|
552
|
-
items.append({"item": item, "variable": item_variable})
|
|
553
|
-
weights += item_variable * item["weight"]
|
|
554
|
-
values += item_variable * item["value"]
|
|
555
|
-
|
|
556
|
-
# This constraint ensures the weight capacity of the knapsack will not be
|
|
557
|
-
# exceeded.
|
|
558
|
-
solver.addConstr(weights <= input.data["weight_capacity"])
|
|
559
|
-
|
|
560
|
-
# Sets the objective function: maximize the value of the chosen items.
|
|
561
|
-
status = solver.maximize(values)
|
|
562
|
-
|
|
563
|
-
# Determines which items were chosen.
|
|
564
|
-
chosen_items = [
|
|
565
|
-
item["item"] for item in items if solver.val(item["variable"]) > 0.9
|
|
566
|
-
]
|
|
567
|
-
|
|
568
|
-
input.options.version = version("highspy")
|
|
569
|
-
|
|
570
|
-
statistics = nextmv.Statistics(
|
|
571
|
-
run=nextmv.RunStatistics(duration=time.time() - start_time),
|
|
572
|
-
result=nextmv.ResultStatistics(
|
|
573
|
-
value=sum(item["value"] for item in chosen_items),
|
|
574
|
-
custom={
|
|
575
|
-
"status": str(status),
|
|
576
|
-
"variables": solver.numVariables,
|
|
577
|
-
"constraints": solver.numConstrs,
|
|
578
|
-
},
|
|
579
|
-
),
|
|
580
|
-
)
|
|
581
|
-
|
|
582
|
-
return nextmv.Output(
|
|
583
|
-
options=input.options,
|
|
584
|
-
solution={"items": chosen_items},
|
|
585
|
-
statistics=statistics,
|
|
586
|
-
)
|
|
587
|
-
```
|
|
588
|
-
|
|
589
|
-
To solve the problem, you can run the model with the input and options:
|
|
590
|
-
|
|
591
|
-
```python
|
|
592
|
-
import json
|
|
593
|
-
|
|
594
|
-
import nextmv
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
model = DecisionModel()
|
|
598
|
-
input = nextmv.Input(data=sample_input, options=options)
|
|
599
|
-
output = model.solve(input)
|
|
600
|
-
print(json.dumps(output.solution, indent=2))
|
|
601
|
-
```
|
|
602
|
-
|
|
603
|
-
If you want to run the model as a Nextmv Cloud app, you need two components:
|
|
604
|
-
|
|
605
|
-
- A model configuration. This configuration tells Nextmv Cloud how to _load_
|
|
606
|
-
the model.
|
|
607
|
-
- An app manifest. Every Nextmv Cloud app must have a manifest that establishes
|
|
608
|
-
how to _run_ the app. It holds information such as the runtime, and files
|
|
609
|
-
that the app needs.
|
|
610
|
-
|
|
611
|
-
Continuing with the knapsack problem, you can define the model configuration
|
|
612
|
-
for it. From the config, there is a convenience function to create the manifest.
|
|
613
|
-
|
|
614
|
-
```python
|
|
615
|
-
import nextmv
|
|
616
|
-
import nextmv.cloud
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
model_configuration = nextmv.ModelConfiguration(
|
|
620
|
-
name="highs_model",
|
|
621
|
-
requirements=[ # Acts as a requirements.txt file.
|
|
622
|
-
"highspy==1.8.1", # Works like a line in a requirements.txt file.
|
|
623
|
-
"nextmv==0.14.0"
|
|
624
|
-
],
|
|
625
|
-
options=options,
|
|
626
|
-
)
|
|
627
|
-
manifest = nextmv.cloud.Manifest.from_model_configuration(model_configuration)
|
|
628
|
-
```
|
|
629
|
-
|
|
630
|
-
Once the model, options, model configuration, and manifest are defined, you can
|
|
631
|
-
[push the app to Nextmv Cloud][push-an-application] and [run
|
|
632
|
-
it][run-an-application].
|
|
633
|
-
|
|
634
|
-
### Cloud
|
|
635
|
-
|
|
636
|
-
Before starting:
|
|
637
|
-
|
|
638
|
-
1. [Sign up][signup] for a Nextmv account.
|
|
639
|
-
2. Get your API key. Go to [Team > API Key][api-key].
|
|
640
|
-
|
|
641
|
-
Visit the [docs][docs] for more information. Make sure that you have your API
|
|
642
|
-
key set as an environment variable:
|
|
643
|
-
|
|
644
|
-
```bash
|
|
645
|
-
export NEXTMV_API_KEY="<YOUR-API-KEY>"
|
|
646
|
-
```
|
|
647
|
-
|
|
648
|
-
Additionally, you must have a valid app in Nextmv Cloud.
|
|
649
|
-
|
|
650
|
-
#### Push an application
|
|
651
|
-
|
|
652
|
-
There are two strategies to push an application to the Nextmv Cloud:
|
|
653
|
-
|
|
654
|
-
1. Specifying `app_dir`, which is the path to an app’s root directory. This
|
|
655
|
-
acts as an external strategy, where the app is composed of files in a
|
|
656
|
-
directory and those apps are packaged and pushed to Nextmv Cloud. This is
|
|
657
|
-
language-agnostic and can work for an app written in any language.
|
|
658
|
-
|
|
659
|
-
Place the following script in the root of your app directory and run it to
|
|
660
|
-
push your app to the Nextmv Cloud. This is equivalent to using the Nextmv
|
|
661
|
-
CLI and running `nextmv app push`.
|
|
662
|
-
|
|
663
|
-
```python
|
|
664
|
-
import os
|
|
665
|
-
|
|
666
|
-
from nextmv import cloud
|
|
667
|
-
|
|
668
|
-
client = cloud.Client(api_key=os.getenv("NEXTMV_API_KEY"))
|
|
669
|
-
app = cloud.Application(client=client, id="<YOUR-APP-ID>")
|
|
670
|
-
app.push() # Use verbose=True for step-by-step output.
|
|
671
|
-
```
|
|
672
|
-
|
|
673
|
-
2. Specifying a `model` and `model_configuration`. This acts as an internal (or
|
|
674
|
-
Python-native) strategy called "Apps from Models", where an app is created
|
|
675
|
-
from a [`nextmv.Model`][model]. The model is encoded, some dependencies and
|
|
676
|
-
accompanying files are packaged, and the app is pushed to Nextmv Cloud.
|
|
677
|
-
|
|
678
|
-
To push a `nextmv.Model` to Nextmv Cloud, you need optional dependencies.
|
|
679
|
-
You can install them by running:
|
|
680
|
-
|
|
681
|
-
```bash
|
|
682
|
-
pip install "nextmv[all]"
|
|
683
|
-
```
|
|
684
|
-
|
|
685
|
-
Once all the optional dependencies are installed, you can push the app to
|
|
686
|
-
Nextmv Cloud.
|
|
687
|
-
|
|
688
|
-
```python
|
|
689
|
-
import os
|
|
690
|
-
|
|
691
|
-
from nextmv import cloud
|
|
692
|
-
|
|
693
|
-
class CustomDecisionModel(nextmv.Model):
|
|
694
|
-
def solve(self, input: nextmv.Input) -> nextmv.Output:
|
|
695
|
-
"""Implement the logic to solve the decision problem here."""
|
|
696
|
-
pass
|
|
697
|
-
|
|
698
|
-
client = cloud.Client(api_key=os.getenv("NEXTMV_API_KEY"))
|
|
699
|
-
app = cloud.Application(client=client, id="<YOUR-APP-ID>")
|
|
700
|
-
|
|
701
|
-
model = CustomDecisionModel()
|
|
702
|
-
options = nextmv.Options() # Define the options here.
|
|
703
|
-
model_configuration = nextmv.ModelConfiguration(
|
|
704
|
-
name="custom_decision_model",
|
|
705
|
-
requirements=[ # Acts as a requirements.txt file.
|
|
706
|
-
"nextmv==0.14.0",
|
|
707
|
-
# Add any other dependencies here.
|
|
708
|
-
],
|
|
709
|
-
options=options,
|
|
710
|
-
)
|
|
711
|
-
manifest = nextmv.cloud.Manifest.from_model_configuration(model_configuration)
|
|
712
|
-
|
|
713
|
-
app.push( # Use verbose=True for step-by-step output.
|
|
714
|
-
manifest=manifest,
|
|
715
|
-
model=model,
|
|
716
|
-
model_configuration=model_configuration,
|
|
717
|
-
)
|
|
718
|
-
```
|
|
719
|
-
|
|
720
|
-
#### Run an application
|
|
721
|
-
|
|
722
|
-
Make a run and get the results.
|
|
723
|
-
|
|
724
|
-
```python
|
|
725
|
-
import os
|
|
726
|
-
|
|
727
|
-
from nextmv import cloud
|
|
728
|
-
|
|
729
|
-
input = {
|
|
730
|
-
"defaults": {"vehicles": {"speed": 20}},
|
|
731
|
-
"stops": [
|
|
732
|
-
{
|
|
733
|
-
"id": "Nijō Castle",
|
|
734
|
-
"location": {"lon": 135.748134, "lat": 35.014239},
|
|
735
|
-
"quantity": -1,
|
|
736
|
-
},
|
|
737
|
-
{
|
|
738
|
-
"id": "Kyoto Imperial Palace",
|
|
739
|
-
"location": {"lon": 135.762057, "lat": 35.025431},
|
|
740
|
-
"quantity": -1,
|
|
741
|
-
},
|
|
742
|
-
],
|
|
743
|
-
"vehicles": [
|
|
744
|
-
{
|
|
745
|
-
"id": "v2",
|
|
746
|
-
"capacity": 2,
|
|
747
|
-
"start_location": {"lon": 135.728898, "lat": 35.039705},
|
|
748
|
-
},
|
|
749
|
-
],
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
client = cloud.Client(api_key=os.getenv("NEXTMV_API_KEY"))
|
|
753
|
-
app = cloud.Application(client=client, id="<YOUR-APP-ID>")
|
|
754
|
-
result = app.new_run_with_result(
|
|
755
|
-
input=input,
|
|
756
|
-
instance_id="latest",
|
|
757
|
-
run_options={"solve.duration": "1s"},
|
|
758
|
-
polling_options=cloud.PollingOptions(), # Customize the polling options.
|
|
759
|
-
)
|
|
760
|
-
print(result.to_dict())
|
|
761
|
-
```
|
|
762
|
-
|
|
763
|
-
[signup]: https://cloud.nextmv.io
|
|
764
|
-
[docs]: https://nextmv.io/docs
|
|
765
|
-
[api-key]: https://cloud.nextmv.io/team/api-keys
|
|
766
|
-
[cloud]: #cloud
|
|
767
|
-
[working-with-a-decision-model]: #working-with-a-decision-model
|
|
768
|
-
[push-an-application]: #push-an-application
|
|
769
|
-
[run-an-application]: #run-an-application
|
|
770
|
-
[model]: #model
|