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/cloud/manifest.py
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
"""Module with the logic for handling an app manifest."""
|
|
2
|
-
|
|
3
|
-
import os
|
|
4
|
-
from enum import Enum
|
|
5
|
-
from typing import Any, Optional
|
|
6
|
-
|
|
7
|
-
import yaml
|
|
8
|
-
from pydantic import AliasChoices, Field
|
|
9
|
-
|
|
10
|
-
from nextmv.base_model import BaseModel
|
|
11
|
-
from nextmv.model import _REQUIREMENTS_FILE, ModelConfiguration
|
|
12
|
-
|
|
13
|
-
FILE_NAME = "app.yaml"
|
|
14
|
-
"""Name of the app manifest file."""
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class ManifestType(str, Enum):
|
|
18
|
-
"""Type of application in the manifest, based on the programming
|
|
19
|
-
language."""
|
|
20
|
-
|
|
21
|
-
PYTHON = "python"
|
|
22
|
-
"""Python format"""
|
|
23
|
-
GO = "go"
|
|
24
|
-
"""Go format"""
|
|
25
|
-
JAVA = "java"
|
|
26
|
-
"""Java format"""
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class ManifestRuntime(str, Enum):
|
|
30
|
-
"""Runtime (environment) where the app will be run on Nextmv Cloud."""
|
|
31
|
-
|
|
32
|
-
DEFAULT = "ghcr.io/nextmv-io/runtime/default:latest"
|
|
33
|
-
"""This runtime is used to run compiled applications such as Go binaries."""
|
|
34
|
-
PYTHON = "ghcr.io/nextmv-io/runtime/python:3.11"
|
|
35
|
-
"""
|
|
36
|
-
This runtime is used as the basis for all other Python runtimes and Python
|
|
37
|
-
applications.
|
|
38
|
-
"""
|
|
39
|
-
JAVA = "ghcr.io/nextmv-io/runtime/java:latest"
|
|
40
|
-
"""This runtime is used to run Java applications."""
|
|
41
|
-
PYOMO = "ghcr.io/nextmv-io/runtime/pyomo:latest"
|
|
42
|
-
"""This runtime provisions Python packages to run Pyomo applications."""
|
|
43
|
-
HEXALY = "ghcr.io/nextmv-io/runtime/hexaly:latest"
|
|
44
|
-
"""
|
|
45
|
-
Based on the python runtime, it provisions (pre-installs) the Hexaly solver
|
|
46
|
-
to run Python applications.
|
|
47
|
-
"""
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
class ManifestBuild(BaseModel):
|
|
51
|
-
"""Build-specific attributes."""
|
|
52
|
-
|
|
53
|
-
command: Optional[str] = None
|
|
54
|
-
"""
|
|
55
|
-
The command to run to build the app. This command will be executed without
|
|
56
|
-
a shell, i.e., directly. The command must exit with a status of 0 to
|
|
57
|
-
continue the push process of the app to Nextmv Cloud. This command is
|
|
58
|
-
executed prior to the pre-push command.
|
|
59
|
-
"""
|
|
60
|
-
environment: Optional[dict[str, Any]] = None
|
|
61
|
-
"""
|
|
62
|
-
Environment variables to set when running the build command given as
|
|
63
|
-
key-value pairs.
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
def environment_to_dict(self) -> dict[str, str]:
|
|
67
|
-
"""
|
|
68
|
-
Convert the environment variables to a dictionary.
|
|
69
|
-
|
|
70
|
-
Returns
|
|
71
|
-
-------
|
|
72
|
-
dict[str, str]
|
|
73
|
-
The environment variables as a dictionary.
|
|
74
|
-
|
|
75
|
-
"""
|
|
76
|
-
|
|
77
|
-
if self.environment is None:
|
|
78
|
-
return {}
|
|
79
|
-
|
|
80
|
-
return {key: str(value) for key, value in self.environment.items()}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
class ManifestPythonModel(BaseModel):
|
|
84
|
-
"""Model-specific instructions for a Python app."""
|
|
85
|
-
|
|
86
|
-
name: str
|
|
87
|
-
"""The name of the decision model."""
|
|
88
|
-
options: Optional[list[dict[str, Any]]] = None
|
|
89
|
-
"""
|
|
90
|
-
Options for the decision model. This is a data representation of the
|
|
91
|
-
`nextmv.Options` class. It consists of a list of dicts. Each dict
|
|
92
|
-
represents the `nextmv.Parameter` class. It is used to be able to
|
|
93
|
-
reconstruct an Options object from data when loading a decision model.
|
|
94
|
-
"""
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
class ManifestPython(BaseModel):
|
|
98
|
-
"""Python-specific instructions."""
|
|
99
|
-
|
|
100
|
-
pip_requirements: Optional[str] = Field(
|
|
101
|
-
serialization_alias="pip-requirements",
|
|
102
|
-
validation_alias=AliasChoices("pip-requirements", "pip_requirements"),
|
|
103
|
-
default=None,
|
|
104
|
-
)
|
|
105
|
-
"""
|
|
106
|
-
Path to a requirements.txt file containing (additional) Python
|
|
107
|
-
dependencies that will be bundled with the app.
|
|
108
|
-
"""
|
|
109
|
-
model: Optional[ManifestPythonModel] = None
|
|
110
|
-
"""
|
|
111
|
-
Information about an encoded decision model as handlded via mlflow. This
|
|
112
|
-
information is used to load the decision model from the app bundle.
|
|
113
|
-
"""
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
class Manifest(BaseModel):
|
|
117
|
-
"""
|
|
118
|
-
An application that runs on the Nextmv Platform must contain a file named
|
|
119
|
-
`app.yaml` which is known as the app manifest. This file is used to specify
|
|
120
|
-
the execution environment for the app.
|
|
121
|
-
|
|
122
|
-
This class represents the app manifest and allows you to load it from a
|
|
123
|
-
file or create it programmatically.
|
|
124
|
-
"""
|
|
125
|
-
|
|
126
|
-
files: list[str]
|
|
127
|
-
"""Mandatory. The files to include (or exclude) in the app."""
|
|
128
|
-
|
|
129
|
-
runtime: ManifestRuntime = ManifestRuntime.PYTHON
|
|
130
|
-
"""
|
|
131
|
-
Mandatory. The runtime to use for the app, it provides the environment in
|
|
132
|
-
which the app runs.
|
|
133
|
-
"""
|
|
134
|
-
type: ManifestType = ManifestType.PYTHON
|
|
135
|
-
"""Mandatory. Type of application, based on the programming language."""
|
|
136
|
-
build: Optional[ManifestBuild] = None
|
|
137
|
-
"""
|
|
138
|
-
Optional. Build-specific attributes. The build.command to run to build the
|
|
139
|
-
app. This command will be executed without a shell, i.e., directly. The
|
|
140
|
-
command must exit with a status of 0 to continue the push process of the
|
|
141
|
-
app to Nextmv Cloud. This command is executed prior to the pre-push
|
|
142
|
-
command. The build.environment is used to set environment variables when
|
|
143
|
-
running the build command given as key-value pairs.
|
|
144
|
-
"""
|
|
145
|
-
pre_push: Optional[str] = Field(
|
|
146
|
-
serialization_alias="pre-push",
|
|
147
|
-
validation_alias=AliasChoices("pre-push", "pre_push"),
|
|
148
|
-
default=None,
|
|
149
|
-
)
|
|
150
|
-
"""
|
|
151
|
-
Optional. A command to run before the app is pushed to the Nextmv Cloud.
|
|
152
|
-
This command can be used to compile a binary, run tests or similar tasks.
|
|
153
|
-
One difference with what is specified under build, is that the command will
|
|
154
|
-
be executed via the shell (i.e., bash -c on Linux & macOS or cmd /c on
|
|
155
|
-
Windows). The command must exit with a status of 0 to continue the push
|
|
156
|
-
process. This command is executed just before the app gets bundled and
|
|
157
|
-
pushed (after the build command).
|
|
158
|
-
"""
|
|
159
|
-
python: Optional[ManifestPython] = None
|
|
160
|
-
"""
|
|
161
|
-
Optional. Only for Python apps. Contains further Python-specific
|
|
162
|
-
attributes.
|
|
163
|
-
"""
|
|
164
|
-
|
|
165
|
-
@classmethod
|
|
166
|
-
def from_yaml(cls, dirpath: str) -> "Manifest":
|
|
167
|
-
"""
|
|
168
|
-
Load a manifest from a YAML file.
|
|
169
|
-
|
|
170
|
-
Parameters
|
|
171
|
-
----------
|
|
172
|
-
dirpath : str
|
|
173
|
-
Path to the directory containing the app.yaml file.
|
|
174
|
-
|
|
175
|
-
Returns
|
|
176
|
-
-------
|
|
177
|
-
Manifest
|
|
178
|
-
The loaded manifest.
|
|
179
|
-
|
|
180
|
-
"""
|
|
181
|
-
|
|
182
|
-
with open(os.path.join(dirpath, FILE_NAME)) as file:
|
|
183
|
-
raw_manifest = yaml.safe_load(file)
|
|
184
|
-
|
|
185
|
-
return cls.from_dict(raw_manifest)
|
|
186
|
-
|
|
187
|
-
def to_yaml(self, dirpath: str) -> None:
|
|
188
|
-
"""
|
|
189
|
-
Write the manifest to a YAML file.
|
|
190
|
-
|
|
191
|
-
Parameters
|
|
192
|
-
----------
|
|
193
|
-
dirpath : str
|
|
194
|
-
Path to the directory where the app.yaml file will be written.
|
|
195
|
-
|
|
196
|
-
"""
|
|
197
|
-
|
|
198
|
-
with open(os.path.join(dirpath, FILE_NAME), "w") as file:
|
|
199
|
-
yaml.dump(self.to_dict(), file)
|
|
200
|
-
|
|
201
|
-
@classmethod
|
|
202
|
-
def from_model_configuration(cls, model_configuration: ModelConfiguration) -> "Manifest":
|
|
203
|
-
"""
|
|
204
|
-
Create a Python manifest from a Python model configuration.
|
|
205
|
-
|
|
206
|
-
Parameters
|
|
207
|
-
----------
|
|
208
|
-
model_configuration : ModelConfiguration
|
|
209
|
-
The model configuration.
|
|
210
|
-
|
|
211
|
-
Returns
|
|
212
|
-
-------
|
|
213
|
-
Manifest
|
|
214
|
-
The Python manifest.
|
|
215
|
-
"""
|
|
216
|
-
|
|
217
|
-
manifest_python_dict = {
|
|
218
|
-
"pip-requirements": _REQUIREMENTS_FILE,
|
|
219
|
-
"model": {
|
|
220
|
-
"name": model_configuration.name,
|
|
221
|
-
},
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
if model_configuration.options is not None:
|
|
225
|
-
manifest_python_dict["model"]["options"] = model_configuration.options.parameters_dict()
|
|
226
|
-
|
|
227
|
-
manifest_python = ManifestPython.from_dict(manifest_python_dict)
|
|
228
|
-
|
|
229
|
-
return cls(
|
|
230
|
-
files=["main.py", f"{model_configuration.name}/**"],
|
|
231
|
-
runtime=ManifestRuntime.PYTHON,
|
|
232
|
-
type=ManifestType.PYTHON,
|
|
233
|
-
python=manifest_python,
|
|
234
|
-
)
|
nextmv/cloud/status.py
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class Status(str, Enum):
|
|
5
|
-
"""Status of a run. Deprecated: use StatusV2."""
|
|
6
|
-
|
|
7
|
-
failed = "failed"
|
|
8
|
-
"""Run failed."""
|
|
9
|
-
running = "running"
|
|
10
|
-
"""Run is running."""
|
|
11
|
-
succeeded = "succeeded"
|
|
12
|
-
"""Run succeeded."""
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class StatusV2(str, Enum):
|
|
16
|
-
"""Status of a run."""
|
|
17
|
-
|
|
18
|
-
canceled = "canceled"
|
|
19
|
-
"""Run was canceled."""
|
|
20
|
-
failed = "failed"
|
|
21
|
-
"""Run failed."""
|
|
22
|
-
none = "none"
|
|
23
|
-
"""Run has no status."""
|
|
24
|
-
queued = "queued"
|
|
25
|
-
"""Run is queued."""
|
|
26
|
-
running = "running"
|
|
27
|
-
"""Run is running."""
|
|
28
|
-
succeeded = "succeeded"
|
|
29
|
-
"""Run succeeded."""
|