Skip to content

Commit fbafcda

Browse files
ENG-4278 Complete the Cloud API
1 parent 14e361c commit fbafcda

File tree

7 files changed

+931
-69
lines changed

7 files changed

+931
-69
lines changed

nextmv/cloud/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
"""Functionality for interacting with the Nextmv Cloud."""
22

3+
from .acceptance_test import AcceptanceTest as AcceptanceTest
4+
from .acceptance_test import AcceptanceTestParams as AcceptanceTestParams
5+
from .acceptance_test import Comparison as Comparison
6+
from .acceptance_test import ComparisonInstance as ComparisonInstance
7+
from .acceptance_test import Metric as Metric
8+
from .acceptance_test import MetricType as MetricType
39
from .application import Application as Application
10+
from .application import DownloadURL as DownloadURL
11+
from .application import ErrorLog as ErrorLog
12+
from .application import Metadata as Metadata
13+
from .application import PollingOptions as PollingOptions
14+
from .application import RunInformation as RunInformation
15+
from .application import RunResult as RunResult
16+
from .application import UploadURL as UploadURL
17+
from .batch_experiment import BatchExperiment as BatchExperiment
18+
from .batch_experiment import BatchExperimentInformation as BatchExperimentInformation
19+
from .batch_experiment import BatchExperimentMetadata as BatchExperimentMetadata
20+
from .batch_experiment import BatchExperimentRun as BatchExperimentRun
421
from .client import Client as Client
22+
from .input_set import InputSet as InputSet

nextmv/cloud/acceptance_test.py

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
"""This module contains definitions for acceptance tests."""
2+
3+
from datetime import datetime
4+
from enum import Enum
5+
6+
from nextmv.base_model import BaseModel
7+
8+
9+
class MetricType(str, Enum):
10+
"""Type of metric when doing a comparison."""
11+
12+
absolute_threshold = "absolute-threshold"
13+
"""Absolute threshold metric type."""
14+
difference_threshold = "difference-threshold"
15+
"""Difference threshold metric type."""
16+
direct_comparison = "direct-comparison"
17+
"""Direct comparison metric type."""
18+
19+
20+
class Comparison(str, Enum):
21+
"""Comparison to use for two metrics."""
22+
23+
equal_to = "eq"
24+
"""Equal to metric type."""
25+
greater_than = "gt"
26+
"""Greater than metric type."""
27+
greater_than_or_equal_to = "ge"
28+
"""Greater than or equal to metric type."""
29+
less_than = "lt"
30+
"""Less than metric type."""
31+
less_than_or_equal_to = "le"
32+
"""Less than or equal to metric type."""
33+
not_equal_to = "ne"
34+
"""Not equal to metric type."""
35+
36+
37+
class AcceptanceTestParams(BaseModel):
38+
"""Parameters of an acceptance test."""
39+
40+
operator: Comparison
41+
"""Operator used to compare two metrics."""
42+
43+
44+
class Metric(BaseModel):
45+
"""A metric is a key performance indicator that is used to evaluate the
46+
performance of a test."""
47+
48+
field: str
49+
"""Field of the metric."""
50+
metric_type: MetricType
51+
"""Type of the metric."""
52+
params: AcceptanceTestParams
53+
"""Parameters of the metric."""
54+
statistic: str
55+
"""Statistic of the metric."""
56+
57+
58+
class ComparisonInstance(BaseModel):
59+
"""An instance used for a comparison."""
60+
61+
instance_id: str
62+
"""ID of the instance."""
63+
version_id: str
64+
"""ID of the version."""
65+
66+
67+
class AcceptanceTest(BaseModel):
68+
"""An acceptance test gives a go/no-go decision criteria for a set of
69+
metrics. It relies on a batch experiment."""
70+
71+
id: str
72+
"""ID of the acceptance test."""
73+
name: str
74+
"""Name of the acceptance test."""
75+
description: str
76+
"""Description of the acceptance test."""
77+
app_id: str
78+
"""ID of the app that owns the acceptance test."""
79+
experiment_id: str
80+
"""ID of the batch experiment underlying in the acceptance test."""
81+
control: ComparisonInstance
82+
"""Control instance of the acceptance test."""
83+
candidate: ComparisonInstance
84+
"""Candidate instance of the acceptance test."""
85+
metrics: list[Metric]
86+
"""Metrics of the acceptance test."""
87+
created_at: datetime
88+
"""Creation date of the acceptance test."""
89+
updated_at: datetime
90+
"""Last update date of the acceptance test."""

0 commit comments

Comments
 (0)