or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

client-setup.mdimmediate-operations.mdindex.mdmodels-types.mdoperation-management.mdscheduled-operations.md
tile.json

tessl/pypi-azure-mgmt-computeschedule

Microsoft Azure ComputeSchedule Management Client Library for Python providing VM scheduling operations.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-mgmt-computeschedule@1.1.x

To install, run

npx @tessl/cli install tessl/pypi-azure-mgmt-computeschedule@1.1.0

index.mddocs/

Azure ComputeSchedule Management SDK

A Python management client library for Microsoft Azure ComputeSchedule service, enabling programmatic management of scheduled operations on Azure virtual machines. The library provides comprehensive APIs for submitting, canceling, and monitoring scheduled actions such as deallocate, hibernate, start, and restart operations on virtual machines, with support for both immediate and scheduled execution.

Package Information

  • Package Name: azure-mgmt-computeschedule
  • Language: Python
  • Installation: pip install azure-mgmt-computeschedule azure-identity
  • API Version: 2025-05-01 (default)

Core Imports

from azure.mgmt.computeschedule import ComputeScheduleMgmtClient
from azure.identity import DefaultAzureCredential

For async operations:

from azure.mgmt.computeschedule.aio import ComputeScheduleMgmtClient

Basic Usage

from azure.mgmt.computeschedule import ComputeScheduleMgmtClient
from azure.identity import DefaultAzureCredential
import os

# Initialize client
credential = DefaultAzureCredential()
subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = ComputeScheduleMgmtClient(credential, subscription_id)

# Submit a scheduled deallocate operation
from azure.mgmt.computeschedule.models import (
    SubmitDeallocateRequest, 
    Schedule, 
    ExecutionParameters,
    Resources,
    DeadlineType
)

# Define the schedule
schedule = Schedule(
    deadline_type=DeadlineType.INITIATE_AT,
    deadline="2024-01-15T10:00:00Z",
    timezone="UTC"
)

# Define execution parameters  
execution_params = ExecutionParameters(
    resources=Resources(
        ids=[
            "/subscriptions/{subscription_id}/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/myVM1",
            "/subscriptions/{subscription_id}/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachines/myVM2"
        ]
    )
)

# Create request
request = SubmitDeallocateRequest(
    schedule=schedule,
    execution_parameters=execution_params
)

# Submit the operation
location = "eastus"
response = client.scheduled_actions.virtual_machines_submit_deallocate(
    locationparameter=location,
    request_body=request
)

print(f"Operation submitted with ID: {response.operation_id}")

Architecture

The Azure ComputeSchedule SDK follows Azure ARM management patterns and provides two main operational modes:

  • Scheduled Operations: Submit operations to be executed at a future time with deadline-based scheduling
  • Immediate Operations: Execute operations immediately without scheduling delays
  • Operation Management: Monitor, cancel, and retrieve error details for submitted operations

Key components:

  • ComputeScheduleMgmtClient: Main client for both sync and async operations
  • Operations: General provider operations interface
  • ScheduledActionsOperations: VM-specific scheduling operations
  • Rich Model Hierarchy: Request/response models, enums, and error handling types

Capabilities

Client Setup and Configuration

Initialize and configure the ComputeSchedule management client with Azure credentials, subscription targeting, and optional custom settings.

class ComputeScheduleMgmtClient:
    def __init__(
        self, 
        credential: TokenCredential, 
        subscription_id: str, 
        base_url: Optional[str] = None, 
        **kwargs: Any
    ) -> None: ...

Client Setup

Operations Discovery

List available operations for the ComputeSchedule resource provider, providing metadata about all operations supported by the service.

def list(self, **kwargs: Any) -> ItemPaged[Operation]:
    """
    List all operations available for the ComputeSchedule provider.
    
    Returns:
    Iterator of Operation objects containing operation metadata
    """

Scheduled Operations

Submit VM operations to be executed at future scheduled times with deadline-based execution control and optimization preferences.

def virtual_machines_submit_deallocate(
    self, 
    locationparameter: str, 
    request_body: Union[SubmitDeallocateRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> DeallocateResourceOperationResponse: ...

def virtual_machines_submit_hibernate(
    self, 
    locationparameter: str, 
    request_body: Union[SubmitHibernateRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> HibernateResourceOperationResponse: ...

def virtual_machines_submit_start(
    self, 
    locationparameter: str, 
    request_body: Union[SubmitStartRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> StartResourceOperationResponse: ...

Scheduled Operations

Immediate Operations

Execute VM operations immediately without scheduling delays, providing direct control over virtual machine lifecycle operations.

def virtual_machines_execute_deallocate(
    self, 
    locationparameter: str, 
    request_body: Union[ExecuteDeallocateRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> DeallocateResourceOperationResponse: ...

def virtual_machines_execute_hibernate(
    self, 
    locationparameter: str, 
    request_body: Union[ExecuteHibernateRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> HibernateResourceOperationResponse: ...

def virtual_machines_execute_start(
    self, 
    locationparameter: str, 
    request_body: Union[ExecuteStartRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> StartResourceOperationResponse: ...

def virtual_machines_execute_create(
    self, 
    locationparameter: str, 
    request_body: Union[ExecuteCreateRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> CreateResourceOperationResponse: ...

def virtual_machines_execute_delete(
    self, 
    locationparameter: str, 
    request_body: Union[ExecuteDeleteRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> DeleteResourceOperationResponse: ...

Immediate Operations

Operation Management

Monitor operation status, cancel running operations, and retrieve detailed error information for troubleshooting failed operations.

def virtual_machines_get_operation_status(
    self, 
    locationparameter: str, 
    request_body: Union[GetOperationStatusRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> GetOperationStatusResponse: ...

def virtual_machines_cancel_operations(
    self, 
    locationparameter: str, 
    request_body: Union[CancelOperationsRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> CancelOperationsResponse: ...

def virtual_machines_get_operation_errors(
    self, 
    locationparameter: str, 
    request_body: Union[GetOperationErrorsRequest, JSON, IO[bytes]], 
    **kwargs: Any
) -> GetOperationErrorsResponse: ...

Operation Management

Models and Types

Comprehensive data structures including request/response models, enumerations, and error handling types for all API operations.

class Schedule:
    deadline_type: DeadlineType
    deadline: str
    timezone: str

class ExecutionParameters:
    resources: Resources
    optimization_preference: Optional[OptimizationPreference]
    retry_policy: Optional[RetryPolicy]

class DeadlineType(str, Enum):
    UNKNOWN = "Unknown"
    INITIATE_AT = "InitiateAt" 
    COMPLETE_BY = "CompleteBy"

Models and Types