Parameter description
Parameter | Type | Description |
cluster | CreateResponse object, str, dict | Cluster ID |
Response description
The get_cluster method returns a GetResponse
object, which encapsulates all interfaces of the Cluster class.
Cluster class
Parameter description
Parameter | Type | Description |
properties | dict, str, Cluster object | Cluster status information |
Attribute description
Attribute | Type | Description |
Name | str | Cluster name |
Id | str | Instance ID |
OwnerId | int | Cluster owner ID |
Description | str | Brief description of the cluster |
CreationTime | str | Creation time of the cluster |
State | str | Cluster status information |
ImageId | str | Image ID |
Groups | str | Instance group information of the cluster |
OperationLogs | list | Operation log |
Metrics | Metrics object | Cluster instance metrics |
UserData | UserData object | User defined information of the cluster |
Configs | Configs object | Cluster instance configurations |
Group class
Parameter description
Parameter | Type | Description |
properties | dict, str, Group object | Running status information of the instance groups in the cluster |
Attribute description
Attribute | Type | Description |
DesiredVMCount | int | Expected number of instances |
ActualVMCount | int | Actual number of instances |
InstanceType | str | Cluster instance type |
ResourceType | str | Resource type. Currently, only the OnDemand and Spot types are supported |
SpotStrategy | str | Spot strategy for an instance. It takes effect only when ResourceType is Spot. Values: SpotWithPriceLimit (Set the maximum price for the spot instance) and SpotAsPriceGo (The system provides a price automatically, and the maximum value is the Pay-As-You-Go price) |
SpotPriceLimit | float | Maximum price of an instance per hour (the price of each instance type, not the price per core*hour). The value can contain at most three decimals. It takes effect when SpotStrategy is SpotWithPriceLimit |
Metrics class
Parameter description
Parameter | Type | Description |
properties | dict, str, Metrics object | Cluster instance metrics |
Attribute description
Attribute | Type | Description |
RunningCount | int | Number of instances that are running |
StartingCount | int | Number of instances that are being started |
StoppingCount | int | Number of instances that are being stopped |
StoppedCount | int | Number of instances that have been stopped |
Example
try:
# some other codes here
client = Client(...
...
cluster = "cls-xxxx"
cluster_desc = client.get_cluster(cluster)
print (cluster_desc.Name, cluster_desc.State)
except ClientError, e:
print (e.get_status_code(), e.get_code(), e.get_requestid(), e.get_msg())