0
# Compute Node Extension Operations
1
2
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.
3
4
## Capabilities
5
6
### Extension Information Retrieval
7
8
Retrieves information about a specific virtual machine extension installed on a compute node.
9
10
```python { .api }
11
def get(self, pool_id, node_id, extension_name, compute_node_extension_get_options=None, custom_headers=None, raw=False, **operation_config):
12
"""
13
Gets information about the specified compute node extension.
14
15
Parameters:
16
- pool_id (str): The ID of the pool that contains the compute node
17
- node_id (str): The ID of the compute node from which to get extension information
18
- extension_name (str): The name of the extension to retrieve
19
- compute_node_extension_get_options (ComputeNodeExtensionGetOptions, optional): Additional parameters for the operation
20
- custom_headers (dict, optional): Headers that will be added to the request
21
- raw (bool, optional): Returns the direct response alongside the deserialized response
22
23
Returns:
24
NodeVMExtension: Information about the specified extension
25
26
Raises:
27
BatchErrorException: If the extension or node is not found
28
"""
29
```
30
31
### Extension Listing
32
33
Lists all virtual machine extensions installed on a specific compute node within a pool.
34
35
```python { .api }
36
def list(self, pool_id, node_id, compute_node_extension_list_options=None, custom_headers=None, raw=False, **operation_config):
37
"""
38
Lists all extensions installed on the specified compute node.
39
40
Parameters:
41
- pool_id (str): The ID of the pool that contains the compute node
42
- node_id (str): The ID of the compute node from which to list extensions
43
- compute_node_extension_list_options (ComputeNodeExtensionListOptions, optional): Additional parameters for the operation
44
- custom_headers (dict, optional): Headers that will be added to the request
45
- raw (bool, optional): Returns the direct response alongside the deserialized response
46
47
Returns:
48
ComputeNodeExtensionListPaged[NodeVMExtension]: A paged collection of extensions
49
50
Raises:
51
BatchErrorException: If the node or pool is not found
52
"""
53
```
54
55
## Usage Examples
56
57
### Get Specific Extension Information
58
59
```python
60
from azure.batch import BatchServiceClient
61
from azure.batch.batch_auth import SharedKeyCredentials
62
63
# Initialize client
64
credentials = SharedKeyCredentials("account_name", "account_key")
65
client = BatchServiceClient(credentials, "https://account.region.batch.azure.com")
66
67
# Get information about a specific extension
68
try:
69
extension_info = client.compute_node_extension.get(
70
pool_id="my-pool",
71
node_id="tvm-123456789_1-20220101t000000z",
72
extension_name="CustomScriptExtension"
73
)
74
75
print(f"Extension Name: {extension_info.vm_extension.name}")
76
print(f"Publisher: {extension_info.vm_extension.publisher}")
77
print(f"Type: {extension_info.vm_extension.type}")
78
print(f"Provisioning State: {extension_info.provisioning_state}")
79
80
except Exception as e:
81
print(f"Error retrieving extension: {e}")
82
```
83
84
### List All Extensions on a Node
85
86
```python
87
# List all extensions on a compute node
88
try:
89
extensions = client.compute_node_extension.list(
90
pool_id="my-pool",
91
node_id="tvm-123456789_1-20220101t000000z"
92
)
93
94
for extension in extensions:
95
print(f"Extension: {extension.vm_extension.name}")
96
print(f" Publisher: {extension.vm_extension.publisher}")
97
print(f" Version: {extension.vm_extension.type_handler_version}")
98
print(f" State: {extension.provisioning_state}")
99
print()
100
101
except Exception as e:
102
print(f"Error listing extensions: {e}")
103
```
104
105
## Types
106
107
### NodeVMExtension
108
109
```python { .api }
110
class NodeVMExtension:
111
"""Information about a virtual machine extension on a compute node."""
112
def __init__(self):
113
self.provisioning_state: str # The provisioning state of the extension
114
self.vm_extension: VMExtension # The virtual machine extension
115
self.instance_view: VMExtensionInstanceView # The extension instance view
116
```
117
118
### VMExtension
119
120
```python { .api }
121
class VMExtension:
122
"""Virtual machine extension definition."""
123
def __init__(self):
124
self.name: str # The name of the extension
125
self.publisher: str # The extension publisher
126
self.type: str # The extension type
127
self.type_handler_version: str # The version of the extension handler
128
self.auto_upgrade_minor_version: bool # Whether to auto-upgrade minor versions
129
self.enable_automatic_upgrade: bool # Whether automatic upgrade is enabled
130
self.settings: object # Extension-specific settings
131
self.protected_settings: object # Protected extension-specific settings
132
self.provision_after_extensions: List[str] # Extensions to provision after
133
```
134
135
### VMExtensionInstanceView
136
137
```python { .api }
138
class VMExtensionInstanceView:
139
"""The instance view of a virtual machine extension."""
140
def __init__(self):
141
self.name: str # The extension name
142
self.statuses: List[InstanceViewStatus] # The extension statuses
143
self.substatuses: List[InstanceViewStatus] # The extension substatuses
144
self.type: str # The extension type
145
self.type_handler_version: str # The version of the extension handler
146
```
147
148
### ComputeNodeExtensionGetOptions
149
150
```python { .api }
151
class ComputeNodeExtensionGetOptions:
152
"""Additional parameters for getting compute node extension."""
153
def __init__(self):
154
self.select: str # OData select clause for filtering returned properties
155
self.timeout: int # The maximum time that the server can spend processing the request
156
self.client_request_id: str # Caller-generated request identity for distributed tracing
157
self.return_client_request_id: bool # Whether the server should return client-request-id
158
self.ocp_date: datetime # The time the request was issued in RFC1123 format
159
```
160
161
### ComputeNodeExtensionListOptions
162
163
```python { .api }
164
class ComputeNodeExtensionListOptions:
165
"""Additional parameters for listing compute node extensions."""
166
def __init__(self):
167
self.select: str # OData select clause for filtering returned properties
168
self.timeout: int # The maximum time that the server can spend processing the request
169
self.client_request_id: str # Caller-generated request identity for distributed tracing
170
self.return_client_request_id: bool # Whether the server should return client-request-id
171
self.ocp_date: datetime # The time the request was issued in RFC1123 format