or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

account-operations.mdapplication-operations.mdcertificate-operations.mdclient-management.mdcompute-node-extension-operations.mdcompute-node-operations.mdfile-operations.mdindex.mdjob-operations.mdjob-schedule-operations.mdpool-operations.mdtask-operations.md

account-operations.mddocs/

0

# Account Operations

1

2

Account-level operations for retrieving information about supported VM images and pool node counts across the batch account. These operations provide account-wide insights and supported configurations.

3

4

## Capabilities

5

6

### Supported VM Images

7

8

Retrieve information about VM images that are supported for use in batch pools.

9

10

```python { .api }

11

def list_supported_images(account_list_supported_images_options=None, custom_headers=None, raw=False, **operation_config):

12

"""

13

List all virtual machine images supported by Azure Batch service.

14

15

This operation returns only images and node agent SKUs that are available

16

for use on compute nodes in batch pools.

17

18

Args:

19

account_list_supported_images_options: Additional options for listing images

20

custom_headers: Custom headers to include in request

21

raw: Return raw response if True

22

23

Returns:

24

ItemPaged[ImageInformation]: Paginated list of supported VM images

25

"""

26

```

27

28

### Pool Node Count Information

29

30

Retrieve aggregated node count information across all pools in the account.

31

32

```python { .api }

33

def list_pool_node_counts(account_list_pool_node_counts_options=None, custom_headers=None, raw=False, **operation_config):

34

"""

35

Get the number of nodes in each state, grouped by pool.

36

37

Args:

38

account_list_pool_node_counts_options: Additional options for listing node counts

39

custom_headers: Custom headers to include in request

40

raw: Return raw response if True

41

42

Returns:

43

ItemPaged[PoolNodeCounts]: Paginated list of pool node count information

44

"""

45

```

46

47

## Usage Examples

48

49

### Listing Supported VM Images

50

51

```python

52

# List all supported images

53

supported_images = client.account.list_supported_images()

54

for image in supported_images:

55

print(f"Image: {image.image_reference.publisher}/{image.image_reference.offer}")

56

print(f" SKU: {image.image_reference.sku}")

57

print(f" Node Agent SKU: {image.node_agent_sku_id}")

58

print(f" OS Type: {image.os_type}")

59

print(f" Verification Type: {image.verification_type}")

60

61

# Check capabilities

62

if image.capabilities:

63

print(f" Capabilities: {', '.join(image.capabilities)}")

64

65

print("---")

66

67

# Filter images for specific requirements

68

linux_images = []

69

windows_images = []

70

71

for image in client.account.list_supported_images():

72

if image.os_type.lower() == "linux":

73

linux_images.append(image)

74

elif image.os_type.lower() == "windows":

75

windows_images.append(image)

76

77

print(f"Found {len(linux_images)} Linux images and {len(windows_images)} Windows images")

78

```

79

80

### Finding Images for Pool Creation

81

82

```python

83

# Find Ubuntu images

84

ubuntu_images = []

85

for image in client.account.list_supported_images():

86

if ("ubuntu" in image.image_reference.offer.lower() or

87

"ubuntu" in image.image_reference.sku.lower()):

88

ubuntu_images.append(image)

89

90

print("Available Ubuntu images:")

91

for image in ubuntu_images:

92

print(f" {image.image_reference.publisher}/{image.image_reference.offer}")

93

print(f" SKU: {image.image_reference.sku}")

94

print(f" Node Agent: {image.node_agent_sku_id}")

95

96

# Find the latest Ubuntu LTS image

97

ubuntu_lts_images = [img for img in ubuntu_images if "lts" in img.image_reference.sku.lower()]

98

if ubuntu_lts_images:

99

latest_ubuntu = ubuntu_lts_images[0] # Typically the first is the latest

100

print(f"\nRecommended Ubuntu LTS image:")

101

print(f" Publisher: {latest_ubuntu.image_reference.publisher}")

102

print(f" Offer: {latest_ubuntu.image_reference.offer}")

103

print(f" SKU: {latest_ubuntu.image_reference.sku}")

104

print(f" Node Agent SKU ID: {latest_ubuntu.node_agent_sku_id}")

105

```

106

107

### Checking Pool Node Counts

108

109

```python

110

# Get node count information for all pools

111

pool_node_counts = client.account.list_pool_node_counts()

112

113

total_dedicated = 0

114

total_low_priority = 0

115

116

for pool_counts in pool_node_counts:

117

print(f"Pool: {pool_counts.pool_id}")

118

print(f" Dedicated nodes:")

119

print(f" Creating: {pool_counts.dedicated.creating}")

120

print(f" Idle: {pool_counts.dedicated.idle}")

121

print(f" Running: {pool_counts.dedicated.running}")

122

print(f" Rebooting: {pool_counts.dedicated.rebooting}")

123

print(f" Reimaging: {pool_counts.dedicated.reimaging}")

124

print(f" Total: {pool_counts.dedicated.total}")

125

126

print(f" Low-priority nodes:")

127

print(f" Creating: {pool_counts.low_priority.creating}")

128

print(f" Idle: {pool_counts.low_priority.idle}")

129

print(f" Running: {pool_counts.low_priority.running}")

130

print(f" Preempted: {pool_counts.low_priority.preempted}")

131

print(f" Total: {pool_counts.low_priority.total}")

132

133

total_dedicated += pool_counts.dedicated.total

134

total_low_priority += pool_counts.low_priority.total

135

print("---")

136

137

print(f"Account totals:")

138

print(f" Total dedicated nodes: {total_dedicated}")

139

print(f" Total low-priority nodes: {total_low_priority}")

140

print(f" Total nodes: {total_dedicated + total_low_priority}")

141

```

142

143

### Image Compatibility Checking

144

145

```python

146

def find_compatible_images(os_type, required_capabilities=None):

147

"""Find VM images compatible with specific requirements."""

148

compatible_images = []

149

required_capabilities = required_capabilities or []

150

151

for image in client.account.list_supported_images():

152

if image.os_type.lower() != os_type.lower():

153

continue

154

155

# Check if image has required capabilities

156

image_capabilities = image.capabilities or []

157

if all(cap in image_capabilities for cap in required_capabilities):

158

compatible_images.append(image)

159

160

return compatible_images

161

162

# Find Linux images with GPU support

163

gpu_linux_images = find_compatible_images("linux", ["cuda", "docker"])

164

print(f"Found {len(gpu_linux_images)} Linux images with GPU/Docker support")

165

166

# Find Windows images

167

windows_images = find_compatible_images("windows")

168

print(f"Found {len(windows_images)} Windows images")

169

170

def get_recommended_image(os_type, prefer_latest=True):

171

"""Get recommended image for a specific OS type."""

172

images = find_compatible_images(os_type)

173

174

if not images:

175

return None

176

177

# Sort by publisher, offer, sku for consistency

178

images.sort(key=lambda x: (x.image_reference.publisher,

179

x.image_reference.offer,

180

x.image_reference.sku))

181

182

if prefer_latest:

183

return images[-1] # Assume last is latest

184

return images[0]

185

186

# Get recommended images

187

recommended_linux = get_recommended_image("linux")

188

recommended_windows = get_recommended_image("windows")

189

190

if recommended_linux:

191

print(f"Recommended Linux image: {recommended_linux.image_reference.offer} {recommended_linux.image_reference.sku}")

192

193

if recommended_windows:

194

print(f"Recommended Windows image: {recommended_windows.image_reference.offer} {recommended_windows.image_reference.sku}")

195

```

196

197

## Types

198

199

### Image Information Types

200

201

```python { .api }

202

class ImageInformation:

203

"""Information about a supported VM image."""

204

def __init__(self):

205

self.node_agent_sku_id: str

206

self.image_reference: ImageReference

207

self.os_type: str # linux, windows

208

self.capabilities: List[str]

209

self.batch_support_end_of_life: datetime.datetime

210

self.verification_type: str # verified, unverified

211

212

class ImageReference:

213

"""Reference to a specific VM image."""

214

def __init__(self):

215

self.publisher: str

216

self.offer: str

217

self.sku: str

218

self.version: str

219

self.virtual_machine_image_id: str # For custom images

220

```

221

222

### Pool Node Count Types

223

224

```python { .api }

225

class PoolNodeCounts:

226

"""Node count information for a pool."""

227

def __init__(self):

228

self.pool_id: str

229

self.dedicated: NodeCounts

230

self.low_priority: NodeCounts

231

232

class NodeCounts:

233

"""Count of nodes in different states."""

234

def __init__(self):

235

self.creating: int

236

self.idle: int

237

self.offline: int

238

self.preempted: int

239

self.rebooting: int

240

self.reimaging: int

241

self.running: int

242

self.starting: int

243

self.start_task_failed: int

244

self.leaving_pool: int

245

self.unknown: int

246

self.unusable: int

247

self.waiting_for_start_task: int

248

self.total: int

249

```

250

251

### Account Operation Option Types

252

253

```python { .api }

254

class AccountListSupportedImagesOptions:

255

"""Options for listing supported images."""

256

def __init__(self):

257

self.filter: str

258

self.max_results: int

259

self.timeout: int

260

261

class AccountListPoolNodeCountsOptions:

262

"""Options for listing pool node counts."""

263

def __init__(self):

264

self.filter: str

265

self.max_results: int

266

self.timeout: int

267

```

268

269

## Notes

270

271

- Supported images list changes over time as new images are added and old ones deprecated

272

- Node agent SKU ID must match the selected image for pool creation to succeed

273

- Image capabilities indicate special features like GPU support, Docker compatibility, etc.

274

- Pool node counts provide real-time information about node states across the account

275

- Use verification_type to distinguish between Microsoft-verified and community images

276

- batch_support_end_of_life indicates when support for an image will end