Skip to content

Switchback module

Reference to the cloud.switchback.py module.

switchback

Classes for working with Nextmv Cloud switchback tests.

This module provides classes for interacting with switchback tests in Nextmv Cloud. It details the core data structures for these types of experiments.

CLASS DESCRIPTION
TestComparisonSingle

A structure to define a single comparison for tests.

SwitchbackPlanUnit

A structure to define a single unit in the switchback plan.

SwitchbackPlan

A structure to define the switchback plan for tests.

SwitchbackTestMetadata

Metadata for a Nextmv Cloud switchback test.

SwitchbackTest

A Nextmv Cloud switchback test definition.

TestComparisonSingle

Bases: BaseModel

A structure to define a single comparison for tests.

You can import the TestComparisonSingle class directly from cloud:

from nextmv.cloud import TestComparisonSingle
PARAMETER DESCRIPTION

baseline_instance_id

ID of the baseline instance for comparison.

TYPE: str

candidate_instance_id

ID of the candidate instance for comparison.

TYPE: str

baseline_instance_id instance-attribute

baseline_instance_id: str

ID of the baseline instance for comparison.

candidate_instance_id instance-attribute

candidate_instance_id: str

ID of the candidate instance for comparison.

SwitchbackPlanUnit

Bases: BaseModel

A structure to define a single unit in the switchback plan.

You can import the SwitchbackPlanUnit class directly from cloud:

from nextmv.cloud import SwitchbackPlanUnit
PARAMETER DESCRIPTION

duration_minutes

Duration of this interval in minutes.

TYPE: float

instance_id

ID of the instance to run during this unit.

TYPE: str

index

Index of this unit in the switchback plan.

TYPE: int

duration_minutes instance-attribute

duration_minutes: float

Duration of this interval in minutes.

instance_id instance-attribute

instance_id: str

ID of the instance to run during this unit.

index instance-attribute

index: int

Index of this unit in the switchback plan.

SwitchbackPlan

Bases: BaseModel

A structure to define the switchback plan for tests.

You can import the SwitchbackPlan class directly from cloud:

from nextmv.cloud import SwitchbackPlan
PARAMETER DESCRIPTION

start

Start time of the switchback test.

TYPE: datetime

units

List of switchback plan units.

TYPE: list[SwitchbackPlanUnit]

start class-attribute instance-attribute

start: datetime | None = None

Start time of the switchback test.

units class-attribute instance-attribute

units: list[SwitchbackPlanUnit] | None = None

List of switchback plan units.

SwitchbackTestMetadata

Bases: BaseModel

Metadata for a Nextmv Cloud switchback test.

You can import the SwitchbackTestMetadata class directly from cloud:

from nextmv.cloud import SwitchbackTestMetadata
PARAMETER DESCRIPTION

switchback_test_id

The unique identifier of the switchback test.

TYPE: str

name

Name of the switchback test.

TYPE: str

description

Description of the switchback test.

TYPE: str

app_id

ID of the application to which the switchback test belongs.

TYPE: str

created_at

Creation date of the switchback test.

TYPE: datetime

updated_at

Last update date of the switchback test.

TYPE: datetime

status

The current status of the switchback test.

TYPE: ExperimentStatus

switchback_test_id class-attribute instance-attribute

switchback_test_id: str | None = Field(
    serialization_alias="id",
    validation_alias=AliasChoices(
        "id", "switchback_test_id"
    ),
    default=None,
)

The unique identifier of the switchback test.

name class-attribute instance-attribute

name: str | None = None

Name of the switchback test.

description class-attribute instance-attribute

description: str | None = None

Description of the switchback test.

app_id class-attribute instance-attribute

app_id: str | None = None

ID of the application to which the switchback test belongs.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Creation date of the switchback test.

updated_at class-attribute instance-attribute

updated_at: datetime | None = None

Last update date of the switchback test.

status class-attribute instance-attribute

status: ExperimentStatus | None = None

The current status of the switchback test.

SwitchbackTest

Bases: BaseModel

A Nextmv Cloud switchback test definition.

A switchback test is a type of experiment where runs are executed in sequential intervals, alternating between different instances to compare their performance.

You can import the SwitchbackTest class directly from cloud:

from nextmv.cloud import SwitchbackTest
PARAMETER DESCRIPTION

switchback_test_id

The unique identifier of the switchback test.

TYPE: str

name

Name of the switchback test.

TYPE: str

description

Description of the switchback test.

TYPE: str

app_id

ID of the application to which the switchback test belongs.

TYPE: str

created_at

Creation date of the switchback test.

TYPE: datetime

updated_at

Last update date of the switchback test.

TYPE: datetime

status

The current status of the switchback test.

TYPE: ExperimentStatus

started_at

Start date of the switchback test, if applicable.

TYPE: datetime

completed_at

Completion date of the switchback test, if applicable.

TYPE: datetime

comparison

Test comparison defined in the switchback test.

TYPE: TestComparisonSingle

plan

Switchback plan defining the intervals and instance switching.

TYPE: SwitchbackPlan

runs

List of runs in the switchback test.

TYPE: list[Run]

switchback_test_id class-attribute instance-attribute

switchback_test_id: str | None = Field(
    serialization_alias="id",
    validation_alias=AliasChoices(
        "id", "switchback_test_id"
    ),
    default=None,
)

The unique identifier of the switchback test.

name class-attribute instance-attribute

name: str | None = None

Name of the switchback test.

description class-attribute instance-attribute

description: str | None = None

Description of the switchback test.

app_id class-attribute instance-attribute

app_id: str | None = None

ID of the application to which the switchback test belongs.

created_at class-attribute instance-attribute

created_at: datetime | None = None

Creation date of the switchback test.

updated_at class-attribute instance-attribute

updated_at: datetime | None = None

Last update date of the switchback test.

status class-attribute instance-attribute

status: ExperimentStatus | None = None

The current status of the switchback test.

started_at class-attribute instance-attribute

started_at: datetime | None = None

Start date of the switchback test, if applicable.

completed_at class-attribute instance-attribute

completed_at: datetime | None = None

Completion date of the switchback test, if applicable.

comparison class-attribute instance-attribute

comparison: TestComparisonSingle | None = None

Test comparison defined in the switchback test.

plan class-attribute instance-attribute

plan: SwitchbackPlan | None = None

Switchback plan defining the intervals and instance switching.

runs class-attribute instance-attribute

runs: list[Run] | None = None

List of runs in the switchback test.