Skip to content

analyses

Contains the types related to analyses.

AnalysisStatus

Bases: str, Enum

Represents the status of an analysis.

CANCELLED = 'cancelled' class-attribute instance-attribute

An analysis that has been cancelled.

COMPLETED = 'completed' class-attribute instance-attribute

An analysis that has been completed.

DEPENDENCY = 'dependency' class-attribute instance-attribute

An analysis that is waiting for a dependency to be resolved.

ENQUEUED = 'enqueued' class-attribute instance-attribute

An analysis that is waiting to be executed.

FAILED = 'failed' class-attribute instance-attribute

An analysis that has failed.

PENDING = 'pending' class-attribute instance-attribute

An analysis that has not yet been started.

REJECTED = 'rejected' class-attribute instance-attribute

An analysis that has been rejected.

REVIEW = 'review' class-attribute instance-attribute

An analysis that is marked for review.

RUNNING = 'running' class-attribute instance-attribute

An analysis that is currently being executed.

SKIPPED = 'skipped' class-attribute instance-attribute

An analysis that was submitted but never executed — e.g. an upstream dependency failed, or it timed out waiting to run. Distinct from FAILED (which ran and errored): no compute ran, so no charge is applied and the reserved credits are released.

is_settled(status) classmethod

Check if the billing lifecycle has ended for status.

Parameters:

Name Type Description Default
status AnalysisStatus

The status of the analysis.

required

Returns:

Name Type Description
bool bool

True if the status is settled (charged or released).

is_terminal(status) classmethod

Check if the analysis status is terminal (i.e., not pending, enqueued, or running).

Parameters:

Name Type Description Default
status AnalysisStatus | str

The status of the analysis (a member or its string value).

required

Returns:

Name Type Description
bool bool

True if the status is terminal, False otherwise.

settled_states() classmethod

Return the states in which the billing lifecycle has ended.

A settled analysis has either been charged (COMPLETED) or released without charge (FAILED / CANCELLED / REJECTED / SKIPPED), and must never transition again. Any live analysis whose status is NOT settled constitutes an uncommitted credit hold.

Deliberately EXCLUDES REVIEW: although is_terminal counts REVIEW as terminal, a review analysis still holds its reservation and later moves to COMPLETED to settle. This is the single canonical definition of the billing end states — do not redeclare it.

Returns:

Type Description
frozenset[AnalysisStatus]

frozenset[AnalysisStatus]: The settled (billing-final) states.

AnalysisType

Bases: str, Enum

Represents the type of an analysis.

AROUSALS = 'arousals' class-attribute instance-attribute

Represents an arousals analysis.

ARTIFACTS = 'artifacts' class-attribute instance-attribute

Represents an artifact detection analysis.

REM = 'rapid-eye-movements' class-attribute instance-attribute

Represents a rapid eye movements analysis.

STAGING = 'staging' class-attribute instance-attribute

Represents a sleep staging analysis.