Account Module¶
This section documents the account components of the Nextmv Cloud API.
account
¶
Account management functionality for the Nextmv Cloud API.
This module provides classes for interacting with account-level resources in the Nextmv Platform, particularly for accessing and managing the queue of runs.
CLASS | DESCRIPTION |
---|---|
QueuedRun |
A run that is pending to be executed in the account. |
Queue |
A list of runs that are pending or currently being executed. |
Account |
The Nextmv Platform account with API access methods. |
Account
dataclass
¶
The Nextmv Platform account.
You can import the Account
class directly from cloud
:
This class provides access to account-level operations in the Nextmv Platform, such as retrieving the queue of runs.
PARAMETER | DESCRIPTION |
---|---|
|
Client to use for interacting with the Nextmv Cloud API.
TYPE:
|
|
Base endpoint for the account, by default "v1/account"
TYPE:
|
ATTRIBUTE | DESCRIPTION |
---|---|
client |
Client to use for interacting with the Nextmv Cloud API.
TYPE:
|
endpoint |
Base endpoint for the account.
TYPE:
|
Examples:
>>> from nextmv.cloud import Client, Account
>>> client = Client(api_key="your-api-key")
>>> account = Account(client=client)
>>> queue = account.queue()
>>> print(f"Number of runs in queue: {len(queue.runs)}")
Number of runs in queue: 3
endpoint
class-attribute
instance-attribute
¶
Base endpoint for the account.
queue
¶
queue() -> Queue
Get the queue of runs in the account.
Retrieves the current list of runs that are pending or being executed in the Nextmv account.
RETURNS | DESCRIPTION |
---|---|
Queue
|
Queue of runs in the account. |
RAISES | DESCRIPTION |
---|---|
HTTPError
|
If the response status code is not 2xx. |
Examples:
>>> account = Account(client=Client(api_key="your-api-key"))
>>> queue = account.queue()
>>> for run in queue.runs:
... print(f"Run {run.id}: {run.name} - Status: {run.status_v2}")
Run run-123: Daily Optimization - Status: RUNNING
Run run-456: Weekly Planning - Status: QUEUED
Source code in nextmv/nextmv/cloud/account.py
Queue
¶
Bases: BaseModel
A queue is a list of runs that are pending to be executed, or currently being executed, in the account.
You can import the Queue
class directly from cloud
:
The Queue object provides access to a list of queued runs in a Nextmv account. It is typically obtained through the Account.queue() method.
ATTRIBUTE | DESCRIPTION |
---|---|
runs |
List of runs in the queue.
TYPE:
|
Examples:
>>> account = Account(client=Client(api_key="your-api-key"))
>>> queue = account.queue()
>>> print(f"Number of runs in queue: {len(queue.runs)}")
Number of runs in queue: 5
>>> # Accessing the first run in the queue
>>> if queue.runs:
... print(f"First run: {queue.runs[0].name}")
First run: My Priority Run
QueuedRun
¶
Bases: BaseModel
A run that is pending to be executed in the account.
You can import the QueuedRun
class directly from cloud
:
Represents details of a run in the queue, including its status and metadata. QueuedRun objects are typically obtained through the Account.queue() method.
ATTRIBUTE | DESCRIPTION |
---|---|
id |
ID of the run.
TYPE:
|
user_email |
Email of the user who created the run.
TYPE:
|
name |
Name of the run.
TYPE:
|
description |
Description of the run.
TYPE:
|
created_at |
Creation date of the run.
TYPE:
|
application_id |
ID of the application used for the run.
TYPE:
|
application_instance_id |
ID of the application instance used for the run.
TYPE:
|
application_version_id |
ID of the application version used for the run.
TYPE:
|
execution_class |
Execution class used for the run.
TYPE:
|
status |
Deprecated: use status_v2.
TYPE:
|
status_v2 |
Status of the run.
TYPE:
|
Examples:
>>> queued_run = QueuedRun.from_dict({
... "id": "run-123456",
... "user_email": "[email protected]",
... "name": "My Run",
... "description": "Test run",
... "created_at": "2023-01-01T12:00:00Z",
... "application_id": "app-123456",
... "application_instance_id": "appins-123456",
... "application_version_id": "appver-123456",
... "execution_class": "standard",
... "status": "RUNNING",
... "status_v2": "RUNNING"
... })
>>> print(queued_run.name)
My Run