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/batch_experiment.py
CHANGED
|
@@ -1,69 +1,330 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""
|
|
2
|
+
This module contains definitions for batch experiments.
|
|
3
|
+
|
|
4
|
+
Classes
|
|
5
|
+
-------
|
|
6
|
+
ExperimentStatus
|
|
7
|
+
Enum representing the status of an experiment.
|
|
8
|
+
BatchExperimentInformation
|
|
9
|
+
Base class for all batch experiment models containing common information.
|
|
10
|
+
BatchExperiment
|
|
11
|
+
Class representing a batch experiment that compares two or more instances.
|
|
12
|
+
BatchExperimentRun
|
|
13
|
+
Class representing a single execution of a batch experiment.
|
|
14
|
+
BatchExperimentMetadata
|
|
15
|
+
Class containing metadata of a batch experiment.
|
|
16
|
+
"""
|
|
2
17
|
|
|
3
18
|
from datetime import datetime
|
|
4
|
-
from
|
|
19
|
+
from enum import Enum
|
|
20
|
+
from typing import Any
|
|
5
21
|
|
|
6
22
|
from nextmv.base_model import BaseModel
|
|
23
|
+
from nextmv.cloud.input_set import InputSet
|
|
24
|
+
from nextmv.run import Run
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ExperimentStatus(str, Enum):
|
|
28
|
+
"""
|
|
29
|
+
Status of an experiment.
|
|
30
|
+
|
|
31
|
+
You can import the `ExperimentStatus` class directly from `cloud`:
|
|
32
|
+
|
|
33
|
+
```python from nextmv.cloud import ExperimentStatus ```
|
|
34
|
+
|
|
35
|
+
This enum represents the comprehensive set of possible states for an
|
|
36
|
+
experiment in Nextmv Cloud.
|
|
37
|
+
|
|
38
|
+
Attributes
|
|
39
|
+
----------
|
|
40
|
+
STARTED : str
|
|
41
|
+
Experiment started.
|
|
42
|
+
COMPLETED : str
|
|
43
|
+
Experiment completed.
|
|
44
|
+
FAILED : str
|
|
45
|
+
Experiment failed.
|
|
46
|
+
DRAFT : str
|
|
47
|
+
Experiment is a draft.
|
|
48
|
+
CANCELED : str
|
|
49
|
+
Experiment was canceled.
|
|
50
|
+
STOPPING : str
|
|
51
|
+
Experiment is stopping.
|
|
52
|
+
DELETING : str
|
|
53
|
+
Experiment is being deleted.
|
|
54
|
+
DELETE_FAILED : str
|
|
55
|
+
Experiment deletion failed.
|
|
56
|
+
UNKNOWN : str
|
|
57
|
+
Experiment status is unknown.
|
|
58
|
+
|
|
59
|
+
Examples
|
|
60
|
+
--------
|
|
61
|
+
>>> from nextmv.cloud import ExperimentStatus
|
|
62
|
+
>>> status = ExperimentStatus.STARTED
|
|
63
|
+
>>> print(f"The status is: {status.value}")
|
|
64
|
+
The status is: started
|
|
65
|
+
|
|
66
|
+
>>> if status == ExperimentStatus.COMPLETED:
|
|
67
|
+
... print("Processing complete.")
|
|
68
|
+
... elif status in [ExperimentStatus.STARTED, ExperimentStatus.STOPPING]:
|
|
69
|
+
... print("Processing in progress.")
|
|
70
|
+
... else:
|
|
71
|
+
... print("Processing has not started or has ended with issues.")
|
|
72
|
+
Processing in progress.
|
|
73
|
+
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
STARTED = "started"
|
|
77
|
+
"""Experiment started."""
|
|
78
|
+
COMPLETED = "completed"
|
|
79
|
+
"""Experiment completed."""
|
|
80
|
+
FAILED = "failed"
|
|
81
|
+
"""Experiment failed."""
|
|
82
|
+
DRAFT = "draft"
|
|
83
|
+
"""Experiment is a draft."""
|
|
84
|
+
CANCELED = "canceled"
|
|
85
|
+
"""Experiment was canceled."""
|
|
86
|
+
STOPPING = "stopping"
|
|
87
|
+
"""Experiment is stopping."""
|
|
88
|
+
DELETING = "deleting"
|
|
89
|
+
"""Experiment is being deleted."""
|
|
90
|
+
DELETE_FAILED = "delete-failed"
|
|
91
|
+
"""Experiment deletion failed."""
|
|
92
|
+
UNKNOWN = "unknown"
|
|
93
|
+
"""Experiment status is unknown."""
|
|
7
94
|
|
|
8
95
|
|
|
9
96
|
class BatchExperimentInformation(BaseModel):
|
|
10
|
-
"""Information about a batch experiment.
|
|
11
|
-
|
|
97
|
+
"""Information about a batch experiment.
|
|
98
|
+
|
|
99
|
+
You can import the `BatchExperimentInformation` class directly from `cloud`:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from nextmv.cloud import BatchExperimentInformation
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This class serves as a base for all the other batch experiment models and
|
|
106
|
+
contains common attributes shared by different types of batch experiments.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
id : str
|
|
111
|
+
ID of the batch experiment.
|
|
112
|
+
name : str
|
|
113
|
+
Name of the batch experiment.
|
|
114
|
+
created_at : datetime
|
|
115
|
+
Creation date of the batch experiment.
|
|
116
|
+
updated_at : datetime
|
|
117
|
+
Last update date of the batch experiment.
|
|
118
|
+
status : str, optional
|
|
119
|
+
Status of the batch experiment. Defaults to None.
|
|
120
|
+
description : str, optional
|
|
121
|
+
Description of the batch experiment. Defaults to None.
|
|
122
|
+
number_of_requested_runs : int, optional
|
|
123
|
+
Number of runs requested for the batch experiment. Defaults to None.
|
|
124
|
+
number_of_runs : int, optional
|
|
125
|
+
Number of runs in the batch experiment. Defaults to None.
|
|
126
|
+
number_of_completed_runs : int, optional
|
|
127
|
+
Number of completed runs in the batch experiment. Defaults to None.
|
|
128
|
+
type : str, optional
|
|
129
|
+
Type of the batch experiment. Defaults to None.
|
|
130
|
+
option_sets : dict[str, dict[str, str]], optional
|
|
131
|
+
Option sets used for the experiment. Defaults to None.
|
|
132
|
+
|
|
133
|
+
Examples
|
|
134
|
+
--------
|
|
135
|
+
>>> from datetime import datetime
|
|
136
|
+
>>> info = BatchExperimentInformation(
|
|
137
|
+
... id="bexp-123",
|
|
138
|
+
... name="Test Experiment",
|
|
139
|
+
... created_at=datetime.now(),
|
|
140
|
+
... updated_at=datetime.now(),
|
|
141
|
+
... status="running",
|
|
142
|
+
... description="A sample batch experiment."
|
|
143
|
+
... )
|
|
144
|
+
>>> print(info.id)
|
|
145
|
+
bexp-123
|
|
146
|
+
>>> print(info.name)
|
|
147
|
+
Test Experiment
|
|
148
|
+
"""
|
|
12
149
|
|
|
150
|
+
id: str
|
|
151
|
+
"""ID of the batch experiment."""
|
|
13
152
|
name: str
|
|
14
153
|
"""Name of the batch experiment."""
|
|
15
|
-
|
|
16
|
-
"""
|
|
17
|
-
|
|
18
|
-
"""
|
|
154
|
+
created_at: datetime
|
|
155
|
+
"""Creation date of the batch experiment."""
|
|
156
|
+
updated_at: datetime
|
|
157
|
+
"""Last update date of the batch experiment."""
|
|
19
158
|
|
|
20
|
-
|
|
159
|
+
status: ExperimentStatus | None = None
|
|
160
|
+
"""Status of the batch experiment."""
|
|
161
|
+
description: str | None = None
|
|
21
162
|
"""Description of the batch experiment."""
|
|
22
|
-
|
|
23
|
-
"""
|
|
163
|
+
number_of_requested_runs: int | None = None
|
|
164
|
+
"""Number of runs requested for the batch experiment."""
|
|
165
|
+
number_of_runs: int | None = None
|
|
166
|
+
"""Number of runs in the batch experiment."""
|
|
167
|
+
number_of_completed_runs: int | None = None
|
|
168
|
+
"""Number of completed runs in the batch experiment."""
|
|
169
|
+
type: str | None = None
|
|
170
|
+
"""Type of the batch experiment."""
|
|
171
|
+
option_sets: dict[str, dict[str, str]] | None = None
|
|
172
|
+
"""Option sets used for the experiment."""
|
|
24
173
|
|
|
25
174
|
|
|
26
175
|
class BatchExperiment(BatchExperimentInformation):
|
|
27
176
|
"""A batch experiment compares two or more instances by executing all the
|
|
28
|
-
inputs contained in the input set.
|
|
177
|
+
inputs contained in the input set.
|
|
29
178
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
179
|
+
You can import the `BatchExperiment` class directly from `cloud`:
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
from nextmv.cloud import BatchExperiment
|
|
183
|
+
```
|
|
34
184
|
|
|
35
|
-
|
|
185
|
+
This class extends `BatchExperimentInformation` with attributes specific
|
|
186
|
+
to a full batch experiment.
|
|
187
|
+
|
|
188
|
+
Parameters
|
|
189
|
+
----------
|
|
190
|
+
input_set_id : str
|
|
191
|
+
ID of the input set used for the experiment.
|
|
192
|
+
instance_ids : list[str]
|
|
193
|
+
List of instance IDs used for the experiment.
|
|
194
|
+
grouped_distributional_summaries : list[dict[str, Any]], optional
|
|
195
|
+
Grouped distributional summaries of the batch experiment. Defaults to
|
|
196
|
+
None.
|
|
197
|
+
runs : list[Run], optional
|
|
198
|
+
List of runs in the batch experiment. Defaults to None.
|
|
199
|
+
"""
|
|
200
|
+
|
|
201
|
+
input_set_id: str
|
|
202
|
+
"""ID of the input set used for the experiment."""
|
|
203
|
+
instance_ids: list[str]
|
|
204
|
+
"""List of instance IDs used for the experiment."""
|
|
205
|
+
grouped_distributional_summaries: list[dict[str, Any]] | None = None
|
|
36
206
|
"""Grouped distributional summaries of the batch experiment."""
|
|
37
|
-
|
|
38
|
-
"""
|
|
207
|
+
runs: list[Run] | None = None
|
|
208
|
+
"""List of runs in the batch experiment."""
|
|
39
209
|
|
|
40
210
|
|
|
41
211
|
class BatchExperimentRun(BaseModel):
|
|
42
|
-
"""A batch experiment run is a single execution of a batch experiment.
|
|
212
|
+
"""A batch experiment run is a single execution of a batch experiment.
|
|
213
|
+
|
|
214
|
+
You can import the `BatchExperimentRun` class directly from `cloud`:
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
from nextmv.cloud import BatchExperimentRun
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
It contains information about the experiment, the input used, and the
|
|
221
|
+
configuration used for the run.
|
|
222
|
+
|
|
223
|
+
Parameters
|
|
224
|
+
----------
|
|
225
|
+
input_id : str
|
|
226
|
+
ID of the input used for the experiment. If a managed input is used,
|
|
227
|
+
this should be the ID of the managed input. If `input_set_id` is provided
|
|
228
|
+
for the run, this should be the ID of an input within that input set.
|
|
229
|
+
option_set : str
|
|
230
|
+
Option set used for the experiment. Defaults to None.
|
|
231
|
+
instance_id : str, optional
|
|
232
|
+
ID of the instance used for the experiment. Defaults to None.
|
|
233
|
+
version_id : str, optional
|
|
234
|
+
ID of the version used for the experiment. Defaults to None.
|
|
235
|
+
input_set_id : str, optional
|
|
236
|
+
ID of the input set used for the experiment. Defaults to None.
|
|
237
|
+
scenario_id : str, optional
|
|
238
|
+
If the batch experiment is a scenario test, this is the ID of that test.
|
|
239
|
+
Defaults to None.
|
|
240
|
+
repetition : int, optional
|
|
241
|
+
Repetition number of the experiment. Defaults to None.
|
|
242
|
+
run_number : str, optional
|
|
243
|
+
Run number of the experiment. Defaults to None.
|
|
244
|
+
"""
|
|
43
245
|
|
|
44
|
-
option_set: str
|
|
45
|
-
"""Option set used for the experiment."""
|
|
46
246
|
input_id: str
|
|
47
247
|
"""ID of the input used for the experiment."""
|
|
48
248
|
|
|
49
|
-
|
|
249
|
+
option_set: str | None = None
|
|
250
|
+
"""Option set used for the experiment."""
|
|
251
|
+
instance_id: str | None = None
|
|
50
252
|
"""ID of the instance used for the experiment."""
|
|
51
|
-
version_id:
|
|
253
|
+
version_id: str | None = None
|
|
52
254
|
"""ID of the version used for the experiment."""
|
|
255
|
+
input_set_id: str | None = None
|
|
256
|
+
"""ID of the input set used for the experiment."""
|
|
257
|
+
scenario_id: str | None = None
|
|
258
|
+
"""If the batch experiment is a scenario test, this is the ID of that test."""
|
|
259
|
+
repetition: int | None = None
|
|
260
|
+
"""Repetition number of the experiment."""
|
|
261
|
+
|
|
262
|
+
def model_post_init(self, __context) -> None:
|
|
263
|
+
"""
|
|
264
|
+
Logic to run after the class is initialized.
|
|
53
265
|
|
|
54
|
-
|
|
55
|
-
"""Logic to run after the class is initialized."""
|
|
266
|
+
Ensures that either `instance_id` or `version_id` is set.
|
|
56
267
|
|
|
268
|
+
Raises
|
|
269
|
+
------
|
|
270
|
+
ValueError
|
|
271
|
+
If both `instance_id` and `version_id` are None.
|
|
272
|
+
"""
|
|
57
273
|
if self.instance_id is None and self.version_id is None:
|
|
58
274
|
raise ValueError("either instance_id or version_id must be set")
|
|
59
275
|
|
|
60
276
|
|
|
61
277
|
class BatchExperimentMetadata(BatchExperimentInformation):
|
|
62
|
-
"""Metadata of a batch experiment.
|
|
278
|
+
"""Metadata of a batch experiment.
|
|
63
279
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
280
|
+
You can import the `BatchExperimentMetadata` class directly from `cloud`:
|
|
281
|
+
|
|
282
|
+
```python
|
|
283
|
+
from nextmv.cloud import BatchExperimentMetadata
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
This class extends `BatchExperimentInformation` with application-specific
|
|
287
|
+
metadata.
|
|
288
|
+
|
|
289
|
+
Parameters
|
|
290
|
+
----------
|
|
291
|
+
app_id : str, optional
|
|
292
|
+
ID of the application used for the batch experiment. Defaults to None.
|
|
293
|
+
"""
|
|
294
|
+
|
|
295
|
+
app_id: str | None = None
|
|
296
|
+
"""ID of the application used for the batch experiment."""
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def to_runs(instance_ids: list[str], input_set: InputSet) -> list[BatchExperimentRun]:
|
|
300
|
+
"""
|
|
301
|
+
Translate a legacy batch experiment list of instance ids to runs.
|
|
302
|
+
|
|
303
|
+
Parameters
|
|
304
|
+
----------
|
|
305
|
+
instance_ids : list[str]
|
|
306
|
+
List of instance IDs to be converted into runs.
|
|
307
|
+
input_set : InputSet
|
|
308
|
+
Input set associated with the runs.
|
|
309
|
+
|
|
310
|
+
Returns
|
|
311
|
+
-------
|
|
312
|
+
list[BatchExperimentRun]
|
|
313
|
+
A list of `BatchExperimentRun` objects created from the instance IDs.
|
|
314
|
+
"""
|
|
315
|
+
|
|
316
|
+
input_ids = input_set.input_ids
|
|
317
|
+
if len(input_set.input_ids) == 0:
|
|
318
|
+
input_ids = [i.id for i in input_set.inputs]
|
|
319
|
+
|
|
320
|
+
runs = []
|
|
321
|
+
for instance_id in instance_ids:
|
|
322
|
+
for input_id in input_ids:
|
|
323
|
+
run = BatchExperimentRun(
|
|
324
|
+
input_id=input_id,
|
|
325
|
+
instance_id=instance_id,
|
|
326
|
+
input_set_id=input_set.id,
|
|
327
|
+
)
|
|
328
|
+
runs.append(run)
|
|
329
|
+
|
|
330
|
+
return runs
|