Microsoft Azure Batch Client Library for Python providing comprehensive APIs for managing batch computing workloads in Azure cloud
91
Compute node extension management capabilities for managing and querying virtual machine extensions on compute nodes within batch pools. VM extensions provide additional functionality like monitoring, security, or application-specific capabilities on compute nodes.
Retrieves information about a specific virtual machine extension installed on a compute node.
def get(self, pool_id, node_id, extension_name, compute_node_extension_get_options=None, custom_headers=None, raw=False, **operation_config):
"""
Gets information about the specified compute node extension.
Parameters:
- pool_id (str): The ID of the pool that contains the compute node
- node_id (str): The ID of the compute node from which to get extension information
- extension_name (str): The name of the extension to retrieve
- compute_node_extension_get_options (ComputeNodeExtensionGetOptions, optional): Additional parameters for the operation
- custom_headers (dict, optional): Headers that will be added to the request
- raw (bool, optional): Returns the direct response alongside the deserialized response
Returns:
NodeVMExtension: Information about the specified extension
Raises:
BatchErrorException: If the extension or node is not found
"""Lists all virtual machine extensions installed on a specific compute node within a pool.
def list(self, pool_id, node_id, compute_node_extension_list_options=None, custom_headers=None, raw=False, **operation_config):
"""
Lists all extensions installed on the specified compute node.
Parameters:
- pool_id (str): The ID of the pool that contains the compute node
- node_id (str): The ID of the compute node from which to list extensions
- compute_node_extension_list_options (ComputeNodeExtensionListOptions, optional): Additional parameters for the operation
- custom_headers (dict, optional): Headers that will be added to the request
- raw (bool, optional): Returns the direct response alongside the deserialized response
Returns:
ComputeNodeExtensionListPaged[NodeVMExtension]: A paged collection of extensions
Raises:
BatchErrorException: If the node or pool is not found
"""from azure.batch import BatchServiceClient
from azure.batch.batch_auth import SharedKeyCredentials
# Initialize client
credentials = SharedKeyCredentials("account_name", "account_key")
client = BatchServiceClient(credentials, "https://account.region.batch.azure.com")
# Get information about a specific extension
try:
extension_info = client.compute_node_extension.get(
pool_id="my-pool",
node_id="tvm-123456789_1-20220101t000000z",
extension_name="CustomScriptExtension"
)
print(f"Extension Name: {extension_info.vm_extension.name}")
print(f"Publisher: {extension_info.vm_extension.publisher}")
print(f"Type: {extension_info.vm_extension.type}")
print(f"Provisioning State: {extension_info.provisioning_state}")
except Exception as e:
print(f"Error retrieving extension: {e}")# List all extensions on a compute node
try:
extensions = client.compute_node_extension.list(
pool_id="my-pool",
node_id="tvm-123456789_1-20220101t000000z"
)
for extension in extensions:
print(f"Extension: {extension.vm_extension.name}")
print(f" Publisher: {extension.vm_extension.publisher}")
print(f" Version: {extension.vm_extension.type_handler_version}")
print(f" State: {extension.provisioning_state}")
print()
except Exception as e:
print(f"Error listing extensions: {e}")class NodeVMExtension:
"""Information about a virtual machine extension on a compute node."""
def __init__(self):
self.provisioning_state: str # The provisioning state of the extension
self.vm_extension: VMExtension # The virtual machine extension
self.instance_view: VMExtensionInstanceView # The extension instance viewclass VMExtension:
"""Virtual machine extension definition."""
def __init__(self):
self.name: str # The name of the extension
self.publisher: str # The extension publisher
self.type: str # The extension type
self.type_handler_version: str # The version of the extension handler
self.auto_upgrade_minor_version: bool # Whether to auto-upgrade minor versions
self.enable_automatic_upgrade: bool # Whether automatic upgrade is enabled
self.settings: object # Extension-specific settings
self.protected_settings: object # Protected extension-specific settings
self.provision_after_extensions: List[str] # Extensions to provision afterclass VMExtensionInstanceView:
"""The instance view of a virtual machine extension."""
def __init__(self):
self.name: str # The extension name
self.statuses: List[InstanceViewStatus] # The extension statuses
self.substatuses: List[InstanceViewStatus] # The extension substatuses
self.type: str # The extension type
self.type_handler_version: str # The version of the extension handlerclass ComputeNodeExtensionGetOptions:
"""Additional parameters for getting compute node extension."""
def __init__(self):
self.select: str # OData select clause for filtering returned properties
self.timeout: int # The maximum time that the server can spend processing the request
self.client_request_id: str # Caller-generated request identity for distributed tracing
self.return_client_request_id: bool # Whether the server should return client-request-id
self.ocp_date: datetime # The time the request was issued in RFC1123 formatclass ComputeNodeExtensionListOptions:
"""Additional parameters for listing compute node extensions."""
def __init__(self):
self.select: str # OData select clause for filtering returned properties
self.timeout: int # The maximum time that the server can spend processing the request
self.client_request_id: str # Caller-generated request identity for distributed tracing
self.return_client_request_id: bool # Whether the server should return client-request-id
self.ocp_date: datetime # The time the request was issued in RFC1123 formatInstall with Tessl CLI
npx tessl i tessl/pypi-azure-batchdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10