nextmv 0.29.5.dev1__py3-none-any.whl → 0.31.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/__init__.py +40 -0
- nextmv/cloud/__init__.py +39 -30
- nextmv/cloud/acceptance_test.py +2 -51
- nextmv/cloud/account.py +1 -1
- nextmv/cloud/application.py +599 -516
- nextmv/cloud/batch_experiment.py +73 -1
- nextmv/cloud/input_set.py +1 -1
- nextmv/cloud/package.py +1 -1
- nextmv/cloud/url.py +73 -0
- nextmv/default_app/.gitignore +1 -0
- nextmv/default_app/app.yaml +2 -0
- nextmv/default_app/src/main.py +2 -1
- nextmv/input.py +17 -1
- nextmv/local/__init__.py +5 -0
- nextmv/local/application.py +1147 -0
- nextmv/local/executor.py +718 -0
- nextmv/local/geojson_handler.py +323 -0
- nextmv/local/plotly_handler.py +61 -0
- nextmv/local/runner.py +312 -0
- nextmv/{cloud/manifest.py → manifest.py} +258 -54
- nextmv/output.py +61 -8
- nextmv/polling.py +287 -0
- nextmv/{cloud/run.py → run.py} +390 -53
- nextmv/{cloud/safe.py → safe.py} +35 -3
- nextmv/{cloud/status.py → status.py} +9 -9
- {nextmv-0.29.5.dev1.dist-info → nextmv-0.31.0.dist-info}/METADATA +5 -1
- nextmv-0.31.0.dist-info/RECORD +46 -0
- nextmv-0.29.5.dev1.dist-info/RECORD +0 -37
- {nextmv-0.29.5.dev1.dist-info → nextmv-0.31.0.dist-info}/WHEEL +0 -0
- {nextmv-0.29.5.dev1.dist-info → nextmv-0.31.0.dist-info}/licenses/LICENSE +0 -0
nextmv/cloud/batch_experiment.py
CHANGED
|
@@ -3,6 +3,8 @@ This module contains definitions for batch experiments.
|
|
|
3
3
|
|
|
4
4
|
Classes
|
|
5
5
|
-------
|
|
6
|
+
ExperimentStatus
|
|
7
|
+
Enum representing the status of an experiment.
|
|
6
8
|
BatchExperimentInformation
|
|
7
9
|
Base class for all batch experiment models containing common information.
|
|
8
10
|
BatchExperiment
|
|
@@ -14,12 +16,82 @@ BatchExperimentMetadata
|
|
|
14
16
|
"""
|
|
15
17
|
|
|
16
18
|
from datetime import datetime
|
|
19
|
+
from enum import Enum
|
|
17
20
|
from typing import Any, Optional
|
|
18
21
|
|
|
19
22
|
from nextmv.base_model import BaseModel
|
|
20
23
|
from nextmv.cloud.input_set import InputSet
|
|
21
24
|
|
|
22
25
|
|
|
26
|
+
class ExperimentStatus(str, Enum):
|
|
27
|
+
"""
|
|
28
|
+
Status of an experiment.
|
|
29
|
+
|
|
30
|
+
You can import the `ExperimentStatus` class directly from `cloud`:
|
|
31
|
+
|
|
32
|
+
```python from nextmv.cloud import ExperimentStatus ```
|
|
33
|
+
|
|
34
|
+
This enum represents the comprehensive set of possible states for an
|
|
35
|
+
experiment in Nextmv Cloud.
|
|
36
|
+
|
|
37
|
+
Attributes
|
|
38
|
+
----------
|
|
39
|
+
STARTED : str
|
|
40
|
+
Experiment started.
|
|
41
|
+
COMPLETED : str
|
|
42
|
+
Experiment completed.
|
|
43
|
+
FAILED : str
|
|
44
|
+
Experiment failed.
|
|
45
|
+
DRAFT : str
|
|
46
|
+
Experiment is a draft.
|
|
47
|
+
CANCELED : str
|
|
48
|
+
Experiment was canceled.
|
|
49
|
+
STOPPING : str
|
|
50
|
+
Experiment is stopping.
|
|
51
|
+
DELETING : str
|
|
52
|
+
Experiment is being deleted.
|
|
53
|
+
DELETE_FAILED : str
|
|
54
|
+
Experiment deletion failed.
|
|
55
|
+
UNKNOWN : str
|
|
56
|
+
Experiment status is unknown.
|
|
57
|
+
|
|
58
|
+
Examples
|
|
59
|
+
--------
|
|
60
|
+
>>> from nextmv.cloud import ExperimentStatus
|
|
61
|
+
>>> status = ExperimentStatus.STARTED
|
|
62
|
+
>>> print(f"The status is: {status.value}")
|
|
63
|
+
The status is: started
|
|
64
|
+
|
|
65
|
+
>>> if status == ExperimentStatus.COMPLETED:
|
|
66
|
+
... print("Processing complete.")
|
|
67
|
+
... elif status in [ExperimentStatus.STARTED, ExperimentStatus.STOPPING]:
|
|
68
|
+
... print("Processing in progress.")
|
|
69
|
+
... else:
|
|
70
|
+
... print("Processing has not started or has ended with issues.")
|
|
71
|
+
Processing in progress.
|
|
72
|
+
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
STARTED = "started"
|
|
76
|
+
"""Experiment started."""
|
|
77
|
+
COMPLETED = "completed"
|
|
78
|
+
"""Experiment completed."""
|
|
79
|
+
FAILED = "failed"
|
|
80
|
+
"""Experiment failed."""
|
|
81
|
+
DRAFT = "draft"
|
|
82
|
+
"""Experiment is a draft."""
|
|
83
|
+
CANCELED = "canceled"
|
|
84
|
+
"""Experiment was canceled."""
|
|
85
|
+
STOPPING = "stopping"
|
|
86
|
+
"""Experiment is stopping."""
|
|
87
|
+
DELETING = "deleting"
|
|
88
|
+
"""Experiment is being deleted."""
|
|
89
|
+
DELETE_FAILED = "delete-failed"
|
|
90
|
+
"""Experiment deletion failed."""
|
|
91
|
+
UNKNOWN = "unknown"
|
|
92
|
+
"""Experiment status is unknown."""
|
|
93
|
+
|
|
94
|
+
|
|
23
95
|
class BatchExperimentInformation(BaseModel):
|
|
24
96
|
"""Information about a batch experiment.
|
|
25
97
|
|
|
@@ -83,7 +155,7 @@ class BatchExperimentInformation(BaseModel):
|
|
|
83
155
|
updated_at: datetime
|
|
84
156
|
"""Last update date of the batch experiment."""
|
|
85
157
|
|
|
86
|
-
status: Optional[
|
|
158
|
+
status: Optional[ExperimentStatus] = None
|
|
87
159
|
"""Status of the batch experiment."""
|
|
88
160
|
description: Optional[str] = None
|
|
89
161
|
"""Description of the batch experiment."""
|
nextmv/cloud/input_set.py
CHANGED
nextmv/cloud/package.py
CHANGED
|
@@ -10,8 +10,8 @@ import tarfile
|
|
|
10
10
|
import tempfile
|
|
11
11
|
from typing import Optional
|
|
12
12
|
|
|
13
|
-
from nextmv.cloud.manifest import MANIFEST_FILE_NAME, Manifest, ManifestBuild, ManifestType
|
|
14
13
|
from nextmv.logger import log
|
|
14
|
+
from nextmv.manifest import MANIFEST_FILE_NAME, Manifest, ManifestBuild, ManifestType
|
|
15
15
|
from nextmv.model import Model, ModelConfiguration, _cleanup_python_model
|
|
16
16
|
|
|
17
17
|
_MANDATORY_FILES_PER_TYPE = {
|
nextmv/cloud/url.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Module for declarations related to upload and download URLs in Nextmv Cloud.
|
|
3
|
+
|
|
4
|
+
Classes
|
|
5
|
+
-------
|
|
6
|
+
DownloadURL
|
|
7
|
+
Represents a download URL for fetching content from Nextmv Cloud.
|
|
8
|
+
UploadURL
|
|
9
|
+
Represents an upload URL for sending content to Nextmv Cloud.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from nextmv.base_model import BaseModel
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DownloadURL(BaseModel):
|
|
16
|
+
"""
|
|
17
|
+
Result of getting a download URL.
|
|
18
|
+
|
|
19
|
+
You can import the `DownloadURL` class directly from `cloud`:
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from nextmv.cloud import DownloadURL
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This class represents a download URL that can be used to fetch content
|
|
26
|
+
from Nextmv Cloud, typically used for downloading large run results.
|
|
27
|
+
|
|
28
|
+
Attributes
|
|
29
|
+
----------
|
|
30
|
+
url : str
|
|
31
|
+
URL to use for downloading the file.
|
|
32
|
+
|
|
33
|
+
Examples
|
|
34
|
+
--------
|
|
35
|
+
>>> download_url = DownloadURL(url="https://example.com/download")
|
|
36
|
+
>>> response = requests.get(download_url.url)
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
url: str
|
|
40
|
+
"""URL to use for downloading the file."""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class UploadURL(BaseModel):
|
|
44
|
+
"""
|
|
45
|
+
Result of getting an upload URL.
|
|
46
|
+
|
|
47
|
+
You can import the `UploadURL` class directly from `cloud`:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from nextmv.cloud import UploadURL
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This class represents an upload URL that can be used to send data to
|
|
54
|
+
Nextmv Cloud, typically used for uploading large inputs for runs.
|
|
55
|
+
|
|
56
|
+
Attributes
|
|
57
|
+
----------
|
|
58
|
+
upload_id : str
|
|
59
|
+
ID of the upload, used to reference the uploaded content.
|
|
60
|
+
upload_url : str
|
|
61
|
+
URL to use for uploading the file.
|
|
62
|
+
|
|
63
|
+
Examples
|
|
64
|
+
--------
|
|
65
|
+
>>> upload_url = UploadURL(upload_id="123", upload_url="https://example.com/upload")
|
|
66
|
+
>>> with open("large_input.json", "rb") as f:
|
|
67
|
+
... requests.put(upload_url.upload_url, data=f)
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
upload_id: str
|
|
71
|
+
"""ID of the upload."""
|
|
72
|
+
upload_url: str
|
|
73
|
+
"""URL to use for uploading the file."""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.nextmv
|
nextmv/default_app/app.yaml
CHANGED
nextmv/default_app/src/main.py
CHANGED
|
@@ -24,7 +24,8 @@ assets = create_visuals(name, input.data["radius"], input.data["distance"])
|
|
|
24
24
|
|
|
25
25
|
# Write output and statistics.
|
|
26
26
|
output = nextmv.Output(
|
|
27
|
-
|
|
27
|
+
options=options,
|
|
28
|
+
solution={"message": message},
|
|
28
29
|
statistics=nextmv.Statistics(
|
|
29
30
|
result=nextmv.ResultStatistics(
|
|
30
31
|
value=1.23,
|
nextmv/input.py
CHANGED
|
@@ -20,6 +20,13 @@ Functions
|
|
|
20
20
|
---------
|
|
21
21
|
load
|
|
22
22
|
Load input data using a specified loader.
|
|
23
|
+
|
|
24
|
+
Constants
|
|
25
|
+
---------
|
|
26
|
+
INPUTS_KEY : str
|
|
27
|
+
Key used for identifying inputs in the run.
|
|
28
|
+
DEFAULT_INPUT_JSON_FILE : str
|
|
29
|
+
Constant for the default input JSON file name.
|
|
23
30
|
"""
|
|
24
31
|
|
|
25
32
|
import copy
|
|
@@ -36,6 +43,15 @@ from nextmv._serialization import serialize_json
|
|
|
36
43
|
from nextmv.deprecated import deprecated
|
|
37
44
|
from nextmv.options import Options
|
|
38
45
|
|
|
46
|
+
INPUTS_KEY = "inputs"
|
|
47
|
+
"""
|
|
48
|
+
Inputs key constant used for identifying inputs in the run.
|
|
49
|
+
"""
|
|
50
|
+
DEFAULT_INPUT_JSON_FILE = "input.json"
|
|
51
|
+
"""
|
|
52
|
+
Constant for the default input JSON file name.
|
|
53
|
+
"""
|
|
54
|
+
|
|
39
55
|
|
|
40
56
|
class InputFormat(str, Enum):
|
|
41
57
|
"""
|
|
@@ -911,7 +927,7 @@ class LocalInputLoader(InputLoader):
|
|
|
911
927
|
If the path is not a directory or the default directory doesn't exist.
|
|
912
928
|
"""
|
|
913
929
|
|
|
914
|
-
dir_path =
|
|
930
|
+
dir_path = INPUTS_KEY
|
|
915
931
|
if path is not None and path != "":
|
|
916
932
|
if not os.path.isdir(path):
|
|
917
933
|
raise ValueError(f"path {path} is not a directory")
|