| 1 |
<html><body> |
| 2 |
<style> |
| 3 |
|
| 4 |
body, h1, h2, h3, div, span, p, pre, a { |
| 5 |
margin: 0; |
| 6 |
padding: 0; |
| 7 |
border: 0; |
| 8 |
font-weight: inherit; |
| 9 |
font-style: inherit; |
| 10 |
font-size: 100%; |
| 11 |
font-family: inherit; |
| 12 |
vertical-align: baseline; |
| 13 |
} |
| 14 |
|
| 15 |
body { |
| 16 |
font-size: 13px; |
| 17 |
padding: 1em; |
| 18 |
} |
| 19 |
|
| 20 |
h1 { |
| 21 |
font-size: 26px; |
| 22 |
margin-bottom: 1em; |
| 23 |
} |
| 24 |
|
| 25 |
h2 { |
| 26 |
font-size: 24px; |
| 27 |
margin-bottom: 1em; |
| 28 |
} |
| 29 |
|
| 30 |
h3 { |
| 31 |
font-size: 20px; |
| 32 |
margin-bottom: 1em; |
| 33 |
margin-top: 1em; |
| 34 |
} |
| 35 |
|
| 36 |
pre, code { |
| 37 |
line-height: 1.5; |
| 38 |
font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 |
} |
| 40 |
|
| 41 |
pre { |
| 42 |
margin-top: 0.5em; |
| 43 |
} |
| 44 |
|
| 45 |
h1, h2, h3, p { |
| 46 |
font-family: Arial, sans serif; |
| 47 |
} |
| 48 |
|
| 49 |
h1, h2, h3 { |
| 50 |
border-bottom: solid #CCC 1px; |
| 51 |
} |
| 52 |
|
| 53 |
.toc_element { |
| 54 |
margin-top: 0.5em; |
| 55 |
} |
| 56 |
|
| 57 |
.firstline { |
| 58 |
margin-left: 2 em; |
| 59 |
} |
| 60 |
|
| 61 |
.method { |
| 62 |
margin-top: 1em; |
| 63 |
border: solid 1px #CCC; |
| 64 |
padding: 1em; |
| 65 |
background: #EEE; |
| 66 |
} |
| 67 |
|
| 68 |
.details { |
| 69 |
font-weight: bold; |
| 70 |
font-size: 14px; |
| 71 |
} |
| 72 |
|
| 73 |
</style> |
| 74 |
|
| 75 |
<h1><a href="compute_beta.html">Compute Engine API</a> . <a href="compute_beta.advice.html">advice</a></h1> |
| 76 |
<h2>Instance Methods</h2> |
| 77 |
<p class="toc_element"> |
| 78 |
<code><a href="#calendarMode">calendarMode(project, region, body=None, x__xgafv=None)</a></code></p> |
| 79 |
<p class="firstline">Advise how, where and when to create the requested amount of instances</p> |
| 80 |
<p class="toc_element"> |
| 81 |
<code><a href="#capacity">capacity(project, region, body=None, x__xgafv=None)</a></code></p> |
| 82 |
<p class="firstline">Advice on making real-time decisions (such as choosing zone or</p> |
| 83 |
<p class="toc_element"> |
| 84 |
<code><a href="#capacityHistory">capacityHistory(project, region, body=None, x__xgafv=None)</a></code></p> |
| 85 |
<p class="firstline">Gets the capacity history.</p> |
| 86 |
<p class="toc_element"> |
| 87 |
<code><a href="#close">close()</a></code></p> |
| 88 |
<p class="firstline">Close httplib2 connections.</p> |
| 89 |
<h3>Method Details</h3> |
| 90 |
<div class="method"> |
| 91 |
<code class="details" id="calendarMode">calendarMode(project, region, body=None, x__xgafv=None)</code> |
| 92 |
<pre>Advise how, where and when to create the requested amount of instances |
| 93 |
with specified accelerators, within the specified time and location limits. |
| 94 |
The method recommends creating future reservations for the requested |
| 95 |
resources. |
| 96 |
|
| 97 |
Args: |
| 98 |
project: string, Project ID for this request. (required) |
| 99 |
region: string, Name of the region for this request. (required) |
| 100 |
body: object, The request body. |
| 101 |
The object takes the form of: |
| 102 |
|
| 103 |
{ # A request to recommend the best way to consume the specified resources in the |
| 104 |
# future. |
| 105 |
"futureResourcesSpecs": { # Specification of resources to create in the future. |
| 106 |
# The key of the map is an arbitrary string specified by the caller. |
| 107 |
# Value of the map is a specification of required resources and their |
| 108 |
# constraints. Currently only one value is allowed in this map. |
| 109 |
"a_key": { # Specification of resources to be created at some time in the future within an |
| 110 |
# optionally specified set of locations, and within the specified time range. |
| 111 |
"deploymentType": "A String", # Indicates if the reservation allocation strategy is static (DENSE) or |
| 112 |
# dynamic (STANDARD). Defaults to DENSE. |
| 113 |
"locationPolicy": { # Specification of locations to create resources in. # Optional location policy allowing to exclude some zone(s) in which |
| 114 |
# the resources must not be created. |
| 115 |
"locations": { # Preferences for specified locations. |
| 116 |
# Keys of the map are locations - zones, in format of 'zones/'. |
| 117 |
# Values are preferences for the zones. |
| 118 |
# If a zone is not specified in this map, it is ALLOWed. |
| 119 |
"a_key": { # Preference for a single specified location. |
| 120 |
"preference": "A String", # Preference for this location. |
| 121 |
}, |
| 122 |
}, |
| 123 |
}, |
| 124 |
"targetResources": { # Specification of reserved resources. # Specification of the reserved resources. |
| 125 |
"aggregateResources": { |
| 126 |
"acceleratorCount": "A String", # Size of the request, in accelerator (chip) count. |
| 127 |
"vmFamily": "A String", # The VM family that all instances scheduled against this reservation |
| 128 |
# must belong to. Use for TPU reservations. |
| 129 |
"workloadType": "A String", # Workload type. Use for TPU reservations. |
| 130 |
}, |
| 131 |
"specificSkuResources": { |
| 132 |
"instanceCount": "A String", # Size of the request, in instance count. |
| 133 |
"localSsdPartitions": [ # Local SSD partitions. You do not have to include SSD partitions that |
| 134 |
# are built in the machine type. |
| 135 |
{ |
| 136 |
"diskInterface": "A String", # Disk interface. Defaults to SCSI. |
| 137 |
"diskSizeGb": "A String", # The size of the disk in GB. |
| 138 |
}, |
| 139 |
], |
| 140 |
"machineType": "A String", # The machine type to use for instances that will use the reservation. |
| 141 |
# This field only accepts machine type names. e.g. n2-standard-4 |
| 142 |
# and does not accept machine type full or partial url. e.g. |
| 143 |
# projects/my-l7ilb-project/zones/us-central1-a/machineTypes/n2-standard-4. |
| 144 |
# Use for GPU reservations. |
| 145 |
}, |
| 146 |
}, |
| 147 |
"timeRangeSpec": { # Specifies a flexible time range with flexible start time and duration. # Specification of a time range in which the resources may be created. |
| 148 |
# The time range specifies start of resource use and planned end of resource |
| 149 |
# use. |
| 150 |
# |
| 151 |
# It is possible to specify a contradictory time range that cannot be matched |
| 152 |
# by any Interval. This causes a validation error. |
| 153 |
"endTimeNotEarlierThan": "A String", |
| 154 |
"endTimeNotLaterThan": "A String", |
| 155 |
"maxDuration": "A String", |
| 156 |
"minDuration": "A String", |
| 157 |
"startTimeNotEarlierThan": "A String", |
| 158 |
"startTimeNotLaterThan": "A String", |
| 159 |
}, |
| 160 |
}, |
| 161 |
}, |
| 162 |
} |
| 163 |
|
| 164 |
x__xgafv: string, V1 error format. |
| 165 |
Allowed values |
| 166 |
1 - v1 error format |
| 167 |
2 - v2 error format |
| 168 |
|
| 169 |
Returns: |
| 170 |
An object of the form: |
| 171 |
|
| 172 |
{ # A response containing the recommended way of creating the specified resources |
| 173 |
# in the future. It contains (will contain) multiple recommendations that can |
| 174 |
# be analyzed by the customer and the best one can be picked. |
| 175 |
"recommendations": [ # Recommendations where, how and when to create the requested resources |
| 176 |
# in order to maximize their obtainability and minimize cost. |
| 177 |
{ # A single recommendation to create requested resources. Contains detailed |
| 178 |
# recommendations for every future resources specification specified in |
| 179 |
# CalendarModeAdviceRequest. |
| 180 |
"recommendationsPerSpec": { # Recommendations for every future resource specification passed in |
| 181 |
# CalendarModeAdviceRequest. Keys of the map correspond to keys |
| 182 |
# specified in the request. |
| 183 |
"a_key": { # Recommendation for single resources specification, to be created in the |
| 184 |
# future. |
| 185 |
"endTime": "A String", |
| 186 |
"location": "A String", # The advised location for resource usage. When a zone, in format |
| 187 |
# 'zones/'. |
| 188 |
# If not set, it means that no location is recommended - see |
| 189 |
# other_locations for details. |
| 190 |
"otherLocations": { # List of locations in the request scope that were not |
| 191 |
# recommended. Keys of the map are zones, in format 'zones/'. |
| 192 |
# The values are status information indicating the recommendation status. |
| 193 |
"a_key": { # Information about recommendation status for locations |
| 194 |
# that were allowed but not used by the response. |
| 195 |
"details": "A String", # Details (human readable) describing the situation. |
| 196 |
# For example, if status is CONDITION_NOT_MET, then |
| 197 |
# details contain information about the parameters of the time window |
| 198 |
# that did not meet the required conditions. |
| 199 |
"status": "A String", # Status of recommendation in this location. |
| 200 |
}, |
| 201 |
}, |
| 202 |
"recommendationId": "A String", # Unique id of the recommendation, a UUID string generated by the API. |
| 203 |
"recommendationType": "A String", # Type of recommendation. Currently only FUTURE_RESERVATION is supported. |
| 204 |
"startTime": "A String", |
| 205 |
}, |
| 206 |
}, |
| 207 |
}, |
| 208 |
], |
| 209 |
}</pre> |
| 210 |
</div> |
| 211 |
|
| 212 |
<div class="method"> |
| 213 |
<code class="details" id="capacity">capacity(project, region, body=None, x__xgafv=None)</code> |
| 214 |
<pre>Advice on making real-time decisions (such as choosing zone or |
| 215 |
machine types) during deployment to maximize your chances of obtaining |
| 216 |
capacity. |
| 217 |
|
| 218 |
Args: |
| 219 |
project: string, Project ID for this request. (required) |
| 220 |
region: string, Name of the region for this request. (required) |
| 221 |
body: object, The request body. |
| 222 |
The object takes the form of: |
| 223 |
|
| 224 |
{ # A request to provide Assistant Scores. These scores determine VM |
| 225 |
# obtainability and preemption likelihood. |
| 226 |
"distributionPolicy": { # Distribution policy. # Policy specifying the distribution of instances across |
| 227 |
# zones within the requested region. |
| 228 |
"targetShape": "A String", # Target distribution shape. You can specify the following values:ANY, ANY_SINGLE_ZONE, or BALANCED. |
| 229 |
"zones": [ # Zones where Capacity Advisor looks for capacity. |
| 230 |
{ # Zone configuration for the distribution policy. |
| 231 |
"zone": "A String", # The URL of the zone. It can be a |
| 232 |
# partial or full URL. For example, the following are valid values: |
| 233 |
# |
| 234 |
# |
| 235 |
# - https://www.googleapis.com/compute/v1/projects/project/zones/zone |
| 236 |
# - projects/project/zones/zone |
| 237 |
# - zones/zone |
| 238 |
}, |
| 239 |
], |
| 240 |
}, |
| 241 |
"instanceFlexibilityPolicy": { # Specification of alternative, flexible instance configurations. # Policy for instance selectors. |
| 242 |
"instanceSelections": { # Named instance selections to configure properties. |
| 243 |
# The key is an arbitrary, unique RFC1035 string that identifies the |
| 244 |
# instance selection. |
| 245 |
"a_key": { # Machine specification. |
| 246 |
"disks": [ # Local SSDs. |
| 247 |
{ # Attached disk configuration. |
| 248 |
"type": "A String", # Specifies the type of the disk. |
| 249 |
# This field must be set to SCRATCH. |
| 250 |
}, |
| 251 |
], |
| 252 |
"guestAccelerators": [ # Accelerators configuration. |
| 253 |
{ # A specification of the type and number of accelerator cards attached to the |
| 254 |
# instance. |
| 255 |
"acceleratorCount": 42, # The number of the guest accelerator cards exposed to this instance. |
| 256 |
"acceleratorType": "A String", # Full or partial URL of the accelerator type resource to attach to this |
| 257 |
# instance. For example:projects/my-project/zones/us-central1-c/acceleratorTypes/nvidia-tesla-p100 |
| 258 |
# If you are creating an instance template, specify only the |
| 259 |
# accelerator name. |
| 260 |
# See GPUs on Compute Engine |
| 261 |
# for a full list of accelerator types. |
| 262 |
}, |
| 263 |
], |
| 264 |
"machineTypes": [ # Full machine-type names, e.g. "n1-standard-16". |
| 265 |
"A String", |
| 266 |
], |
| 267 |
}, |
| 268 |
}, |
| 269 |
}, |
| 270 |
"instanceProperties": { # Instance provisioning properties. # Instance properties for this request. |
| 271 |
"scheduling": { # Defines the instance scheduling options. # Specifies the scheduling options. |
| 272 |
"provisioningModel": "A String", # Specifies the provisioning model. |
| 273 |
}, |
| 274 |
}, |
| 275 |
"size": 42, # The number of VM instances to request. |
| 276 |
} |
| 277 |
|
| 278 |
x__xgafv: string, V1 error format. |
| 279 |
Allowed values |
| 280 |
1 - v1 error format |
| 281 |
2 - v2 error format |
| 282 |
|
| 283 |
Returns: |
| 284 |
An object of the form: |
| 285 |
|
| 286 |
{ # A response contains scoring recommendations. |
| 287 |
"recommendations": [ # Initially the API will provide one recommendation which balances the |
| 288 |
# individual scores according to the service provider's preference. |
| 289 |
{ # Recommendation. |
| 290 |
"scores": { # Groups information about a shard of capacity. # Scores for the recommendation. |
| 291 |
"estimatedUptime": "A String", # The estimated run time of the majority of Spot VMs in the request |
| 292 |
# before preemption. The estimate is best-effort only. It is based on |
| 293 |
# historical data and current conditions. |
| 294 |
"obtainability": 3.14, # The obtainability score indicates the likelihood of successfully |
| 295 |
# obtaining (provisioning) the requested number of VMs. |
| 296 |
# The score range is 0.0 through 1.0. Higher is better. |
| 297 |
}, |
| 298 |
"shards": [ # Shards represent blocks of uniform capacity in recommendations. |
| 299 |
{ # Shards represent blocks of uniform capacity in recommendations. |
| 300 |
# Each shard is for a single zone and a single machine shape. Each shard |
| 301 |
# defines a size expressed as the number of VMs. |
| 302 |
"instanceCount": 42, # The number of instances. |
| 303 |
"machineType": "A String", # The machine type corresponds to the instance selection in the request. |
| 304 |
"provisioningModel": "A String", # The provisioning model that you want to view recommendations for. |
| 305 |
"zone": "A String", # Output only. The zone name for this shard. |
| 306 |
}, |
| 307 |
], |
| 308 |
}, |
| 309 |
], |
| 310 |
}</pre> |
| 311 |
</div> |
| 312 |
|
| 313 |
<div class="method"> |
| 314 |
<code class="details" id="capacityHistory">capacityHistory(project, region, body=None, x__xgafv=None)</code> |
| 315 |
<pre>Gets the capacity history. |
| 316 |
|
| 317 |
Args: |
| 318 |
project: string, Project ID for this request. (required) |
| 319 |
region: string, Name of the region for this request. (required) |
| 320 |
body: object, The request body. |
| 321 |
The object takes the form of: |
| 322 |
|
| 323 |
{ # A request to get the capacity history. |
| 324 |
"instanceProperties": { # Instance properties for this request. # Instance properties for this request. |
| 325 |
"machineType": "A String", # The machine type for the VM, such as `n2-standard-4`. |
| 326 |
"scheduling": { # Scheduling options. # Specifies the scheduling options. |
| 327 |
"provisioningModel": "A String", # The provisioning model to get capacity history for. |
| 328 |
# This field must be set to SPOT. |
| 329 |
# |
| 330 |
# For more information, see |
| 331 |
# Compute Engine instances provisioning models. |
| 332 |
}, |
| 333 |
}, |
| 334 |
"locationPolicy": { # Location policy for this request. # Location policy for this request. |
| 335 |
"location": "A String", # The region or zone to get capacity history for. |
| 336 |
# |
| 337 |
# It can be a partial or full URL. For example, the following are valid |
| 338 |
# values: |
| 339 |
# |
| 340 |
# |
| 341 |
# - https://www.googleapis.com/compute/v1/projects/project/zones/zone |
| 342 |
# - projects/project/zones/zone |
| 343 |
# - zones/zone |
| 344 |
# |
| 345 |
# |
| 346 |
# |
| 347 |
# This field is optional. |
| 348 |
}, |
| 349 |
"types": [ # List of history types to get capacity history for. |
| 350 |
"A String", |
| 351 |
], |
| 352 |
} |
| 353 |
|
| 354 |
x__xgafv: string, V1 error format. |
| 355 |
Allowed values |
| 356 |
1 - v1 error format |
| 357 |
2 - v2 error format |
| 358 |
|
| 359 |
Returns: |
| 360 |
An object of the form: |
| 361 |
|
| 362 |
{ # Contains the capacity history. |
| 363 |
"location": "A String", |
| 364 |
"machineType": "A String", |
| 365 |
"preemptionHistory": [ |
| 366 |
{ |
| 367 |
"interval": { # Represents a time interval, encoded as a Timestamp start (inclusive) and a |
| 368 |
# Timestamp end (exclusive). |
| 369 |
# |
| 370 |
# The start must be less than or equal to the end. |
| 371 |
# When the start equals the end, the interval is empty (matches no time). |
| 372 |
# When both start and end are unspecified, the interval matches any time. |
| 373 |
"endTime": "A String", # Optional. Exclusive end of the interval. |
| 374 |
# |
| 375 |
# If specified, a Timestamp matching this interval will have to be before the |
| 376 |
# end. |
| 377 |
"startTime": "A String", # Optional. Inclusive start of the interval. |
| 378 |
# |
| 379 |
# If specified, a Timestamp matching this interval will have to be the same |
| 380 |
# or after the start. |
| 381 |
}, |
| 382 |
"preemptionRate": 3.14, |
| 383 |
}, |
| 384 |
], |
| 385 |
"priceHistory": [ |
| 386 |
{ |
| 387 |
"interval": { # Represents a time interval, encoded as a Timestamp start (inclusive) and a |
| 388 |
# Timestamp end (exclusive). |
| 389 |
# |
| 390 |
# The start must be less than or equal to the end. |
| 391 |
# When the start equals the end, the interval is empty (matches no time). |
| 392 |
# When both start and end are unspecified, the interval matches any time. |
| 393 |
"endTime": "A String", # Optional. Exclusive end of the interval. |
| 394 |
# |
| 395 |
# If specified, a Timestamp matching this interval will have to be before the |
| 396 |
# end. |
| 397 |
"startTime": "A String", # Optional. Inclusive start of the interval. |
| 398 |
# |
| 399 |
# If specified, a Timestamp matching this interval will have to be the same |
| 400 |
# or after the start. |
| 401 |
}, |
| 402 |
"listPrice": { # Represents an amount of money with its currency type. |
| 403 |
"currencyCode": "A String", # The three-letter currency code defined in ISO 4217. |
| 404 |
"nanos": 42, # Number of nano (10^-9) units of the amount. |
| 405 |
# The value must be between -999,999,999 and +999,999,999 inclusive. |
| 406 |
# If `units` is positive, `nanos` must be positive or zero. |
| 407 |
# If `units` is zero, `nanos` can be positive, zero, or negative. |
| 408 |
# If `units` is negative, `nanos` must be negative or zero. |
| 409 |
# For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. |
| 410 |
"units": "A String", # The whole units of the amount. |
| 411 |
# For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. |
| 412 |
}, |
| 413 |
}, |
| 414 |
], |
| 415 |
}</pre> |
| 416 |
</div> |
| 417 |
|
| 418 |
<div class="method"> |
| 419 |
<code class="details" id="close">close()</code> |
| 420 |
<pre>Close httplib2 connections.</pre> |
| 421 |
</div> |
| 422 |
|
| 423 |
</body></html> |