nextmv 0.10.3.dev0__py3-none-any.whl → 0.35.0__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 +39 -0
- nextmv/__init__.py +57 -0
- nextmv/_serialization.py +96 -0
- nextmv/base_model.py +79 -9
- nextmv/cloud/__init__.py +71 -10
- nextmv/cloud/acceptance_test.py +888 -17
- nextmv/cloud/account.py +154 -10
- nextmv/cloud/application.py +3644 -437
- nextmv/cloud/batch_experiment.py +292 -33
- nextmv/cloud/client.py +354 -53
- nextmv/cloud/ensemble.py +247 -0
- nextmv/cloud/input_set.py +121 -4
- nextmv/cloud/instance.py +125 -0
- nextmv/cloud/package.py +474 -0
- nextmv/cloud/scenario.py +410 -0
- nextmv/cloud/secrets.py +234 -0
- nextmv/cloud/url.py +73 -0
- nextmv/cloud/version.py +174 -0
- 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/main.py +37 -0
- nextmv/default_app/src/visuals.py +36 -0
- nextmv/deprecated.py +47 -0
- nextmv/input.py +883 -78
- nextmv/local/__init__.py +5 -0
- nextmv/local/application.py +1263 -0
- nextmv/local/executor.py +1040 -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 +1472 -0
- nextmv/model.py +431 -0
- nextmv/options.py +968 -78
- nextmv/output.py +1363 -231
- nextmv/polling.py +287 -0
- nextmv/run.py +1623 -0
- nextmv/safe.py +145 -0
- nextmv/status.py +122 -0
- {nextmv-0.10.3.dev0.dist-info → nextmv-0.35.0.dist-info}/METADATA +51 -288
- nextmv-0.35.0.dist-info/RECORD +50 -0
- {nextmv-0.10.3.dev0.dist-info → nextmv-0.35.0.dist-info}/WHEEL +1 -1
- nextmv/cloud/status.py +0 -29
- nextmv/nextroute/__init__.py +0 -2
- nextmv/nextroute/check/__init__.py +0 -26
- nextmv/nextroute/check/schema.py +0 -141
- nextmv/nextroute/schema/__init__.py +0 -19
- nextmv/nextroute/schema/input.py +0 -52
- nextmv/nextroute/schema/location.py +0 -13
- nextmv/nextroute/schema/output.py +0 -136
- nextmv/nextroute/schema/stop.py +0 -61
- nextmv/nextroute/schema/vehicle.py +0 -68
- nextmv-0.10.3.dev0.dist-info/RECORD +0 -28
- {nextmv-0.10.3.dev0.dist-info → nextmv-0.35.0.dist-info}/licenses/LICENSE +0 -0
nextmv/cloud/account.py
CHANGED
|
@@ -1,14 +1,83 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Account management functionality for the Nextmv Cloud API.
|
|
3
|
+
|
|
4
|
+
This module provides classes for interacting with account-level resources
|
|
5
|
+
in the Nextmv Platform, particularly for accessing and managing the queue
|
|
6
|
+
of runs.
|
|
7
|
+
|
|
8
|
+
Classes
|
|
9
|
+
-------
|
|
10
|
+
QueuedRun
|
|
11
|
+
A run that is pending to be executed in the account.
|
|
12
|
+
Queue
|
|
13
|
+
A list of runs that are pending or currently being executed.
|
|
14
|
+
Account
|
|
15
|
+
The Nextmv Platform account with API access methods.
|
|
16
|
+
"""
|
|
17
|
+
|
|
1
18
|
from dataclasses import dataclass
|
|
2
19
|
from datetime import datetime
|
|
3
|
-
from typing import List
|
|
4
20
|
|
|
5
21
|
from nextmv.base_model import BaseModel
|
|
6
22
|
from nextmv.cloud.client import Client
|
|
7
|
-
from nextmv.
|
|
23
|
+
from nextmv.status import Status, StatusV2
|
|
8
24
|
|
|
9
25
|
|
|
10
26
|
class QueuedRun(BaseModel):
|
|
11
|
-
"""A run that is pending to be executed in the account.
|
|
27
|
+
"""A run that is pending to be executed in the account.
|
|
28
|
+
|
|
29
|
+
You can import the `QueuedRun` class directly from `cloud`:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from nextmv.cloud import QueuedRun
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Represents details of a run in the queue, including its status and metadata.
|
|
36
|
+
QueuedRun objects are typically obtained through the Account.queue() method.
|
|
37
|
+
|
|
38
|
+
Attributes
|
|
39
|
+
----------
|
|
40
|
+
id : str
|
|
41
|
+
ID of the run.
|
|
42
|
+
user_email : str
|
|
43
|
+
Email of the user who created the run.
|
|
44
|
+
name : str
|
|
45
|
+
Name of the run.
|
|
46
|
+
description : str
|
|
47
|
+
Description of the run.
|
|
48
|
+
created_at : datetime
|
|
49
|
+
Creation date of the run.
|
|
50
|
+
application_id : str
|
|
51
|
+
ID of the application used for the run.
|
|
52
|
+
application_instance_id : str
|
|
53
|
+
ID of the application instance used for the run.
|
|
54
|
+
application_version_id : str
|
|
55
|
+
ID of the application version used for the run.
|
|
56
|
+
execution_class : str
|
|
57
|
+
Execution class used for the run.
|
|
58
|
+
status : Status
|
|
59
|
+
Deprecated: use status_v2.
|
|
60
|
+
status_v2 : StatusV2
|
|
61
|
+
Status of the run.
|
|
62
|
+
|
|
63
|
+
Examples
|
|
64
|
+
--------
|
|
65
|
+
>>> queued_run = QueuedRun.from_dict({
|
|
66
|
+
... "id": "run-123456",
|
|
67
|
+
... "user_email": "user@example.com",
|
|
68
|
+
... "name": "My Run",
|
|
69
|
+
... "description": "Test run",
|
|
70
|
+
... "created_at": "2023-01-01T12:00:00Z",
|
|
71
|
+
... "application_id": "app-123456",
|
|
72
|
+
... "application_instance_id": "appins-123456",
|
|
73
|
+
... "application_version_id": "appver-123456",
|
|
74
|
+
... "execution_class": "standard",
|
|
75
|
+
... "status": "RUNNING",
|
|
76
|
+
... "status_v2": "RUNNING"
|
|
77
|
+
... })
|
|
78
|
+
>>> print(queued_run.name)
|
|
79
|
+
My Run
|
|
80
|
+
"""
|
|
12
81
|
|
|
13
82
|
id: str
|
|
14
83
|
"""ID of the run."""
|
|
@@ -36,15 +105,74 @@ class QueuedRun(BaseModel):
|
|
|
36
105
|
|
|
37
106
|
class Queue(BaseModel):
|
|
38
107
|
"""A queue is a list of runs that are pending to be executed, or currently
|
|
39
|
-
being executed, in the account.
|
|
108
|
+
being executed, in the account.
|
|
109
|
+
|
|
110
|
+
You can import the `Queue` class directly from `cloud`:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from nextmv.cloud import Queue
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The Queue object provides access to a list of queued runs in a Nextmv account.
|
|
117
|
+
It is typically obtained through the Account.queue() method.
|
|
40
118
|
|
|
41
|
-
|
|
119
|
+
Attributes
|
|
120
|
+
----------
|
|
121
|
+
runs : list[QueuedRun]
|
|
122
|
+
List of runs in the queue.
|
|
123
|
+
|
|
124
|
+
Examples
|
|
125
|
+
--------
|
|
126
|
+
>>> account = Account(client=Client(api_key="your-api-key"))
|
|
127
|
+
>>> queue = account.queue()
|
|
128
|
+
>>> print(f"Number of runs in queue: {len(queue.runs)}")
|
|
129
|
+
Number of runs in queue: 5
|
|
130
|
+
>>> # Accessing the first run in the queue
|
|
131
|
+
>>> if queue.runs:
|
|
132
|
+
... print(f"First run: {queue.runs[0].name}")
|
|
133
|
+
First run: My Priority Run
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
runs: list[QueuedRun]
|
|
42
137
|
"""List of runs in the queue."""
|
|
43
138
|
|
|
44
139
|
|
|
45
140
|
@dataclass
|
|
46
141
|
class Account:
|
|
47
|
-
"""The Nextmv Platform account.
|
|
142
|
+
"""The Nextmv Platform account.
|
|
143
|
+
|
|
144
|
+
You can import the `Account` class directly from `cloud`:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from nextmv.cloud import Account
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
This class provides access to account-level operations in the Nextmv Platform,
|
|
151
|
+
such as retrieving the queue of runs.
|
|
152
|
+
|
|
153
|
+
Parameters
|
|
154
|
+
----------
|
|
155
|
+
client : Client
|
|
156
|
+
Client to use for interacting with the Nextmv Cloud API.
|
|
157
|
+
endpoint : str, optional
|
|
158
|
+
Base endpoint for the account, by default "v1/account"
|
|
159
|
+
|
|
160
|
+
Attributes
|
|
161
|
+
----------
|
|
162
|
+
client : Client
|
|
163
|
+
Client to use for interacting with the Nextmv Cloud API.
|
|
164
|
+
endpoint : str
|
|
165
|
+
Base endpoint for the account.
|
|
166
|
+
|
|
167
|
+
Examples
|
|
168
|
+
--------
|
|
169
|
+
>>> from nextmv.cloud import Client, Account
|
|
170
|
+
>>> client = Client(api_key="your-api-key")
|
|
171
|
+
>>> account = Account(client=client)
|
|
172
|
+
>>> queue = account.queue()
|
|
173
|
+
>>> print(f"Number of runs in queue: {len(queue.runs)}")
|
|
174
|
+
Number of runs in queue: 3
|
|
175
|
+
"""
|
|
48
176
|
|
|
49
177
|
client: Client
|
|
50
178
|
"""Client to use for interacting with the Nextmv Cloud API."""
|
|
@@ -55,11 +183,27 @@ class Account:
|
|
|
55
183
|
def queue(self) -> Queue:
|
|
56
184
|
"""Get the queue of runs in the account.
|
|
57
185
|
|
|
58
|
-
|
|
59
|
-
|
|
186
|
+
Retrieves the current list of runs that are pending or being executed
|
|
187
|
+
in the Nextmv account.
|
|
188
|
+
|
|
189
|
+
Returns
|
|
190
|
+
-------
|
|
191
|
+
Queue
|
|
192
|
+
Queue of runs in the account.
|
|
193
|
+
|
|
194
|
+
Raises
|
|
195
|
+
------
|
|
196
|
+
requests.HTTPError
|
|
197
|
+
If the response status code is not 2xx.
|
|
60
198
|
|
|
61
|
-
|
|
62
|
-
|
|
199
|
+
Examples
|
|
200
|
+
--------
|
|
201
|
+
>>> account = Account(client=Client(api_key="your-api-key"))
|
|
202
|
+
>>> queue = account.queue()
|
|
203
|
+
>>> for run in queue.runs:
|
|
204
|
+
... print(f"Run {run.id}: {run.name} - Status: {run.status_v2}")
|
|
205
|
+
Run run-123: Daily Optimization - Status: RUNNING
|
|
206
|
+
Run run-456: Weekly Planning - Status: QUEUED
|
|
63
207
|
"""
|
|
64
208
|
response = self.client.request(
|
|
65
209
|
method="GET",
|