@@ -37,7 +37,8 @@ function deploy_cluster(gcptype::Type{GoogleCloud},
3737 # image_id_workers = get(cluster_features, :image_id, defaults_dict[GoogleCloud][:image_id])
3838 # image_id_manager = get(cluster_features, :image_id_manager, defaults_dict[GoogleCloud][:image_id_manager])
3939 zone = get (cluster_features, :zone , defaults_dict[GoogleCloud][:zone ])
40- project = defaults_dict[GoogleCloud][:project ]
40+ project = get (cluster_features, :project , defaults_dict[GoogleCloud][:project ])
41+ network_interface = get (cluster_features, :network_interface , get (defaults_dict[GoogleCloud], :network_interface , " default" ))
4142 instance_type_manager = instance_type[1 ]
4243 instance_type_worker = instance_type[2 ]
4344
@@ -51,6 +52,7 @@ function deploy_cluster(gcptype::Type{GoogleCloud},
5152 user_worker,
5253 zone,
5354 project,
55+ network_interface,
5456 nothing ,
5557 cluster_features)
5658
@@ -76,7 +78,11 @@ function deploy_cluster(gcptype::Type{GoogleCloud},
7678 imageid = get (cluster_features, :imageid , defaults_dict[GoogleCloud][:imageid ])
7779 user = get (cluster_features, :user , defaults_dict[GoogleCloud][:user ])
7880 zone = get (cluster_features, :zone , defaults_dict[GoogleCloud][:zone ])
79- project = defaults_dict[GoogleCloud][:project ]
81+ project = get (cluster_features, :project , defaults_dict[GoogleCloud][:project ])
82+ network_interface = get (cluster_features, :network_interface , get (defaults_dict[GoogleCloud],:network_interface , " default" ))
83+
84+
85+ # get(cluster_features, :placement_group, get(defaults_dict[AmazonEC2], :placement_group, nothing))
8086
8187 cluster = gcp_build_clusterobj (cluster_type,
8288 string (cluster_handle),
@@ -86,6 +92,7 @@ function deploy_cluster(gcptype::Type{GoogleCloud},
8692 user,
8793 zone,
8894 project,
95+ network_interface,
8996 nothing ,
9097 cluster_features)
9198
@@ -98,11 +105,11 @@ function deploy_cluster(gcptype::Type{GoogleCloud},
98105 return cluster
99106end
100107
101- gcp_build_clusterobj (_:: Type{<:PeerWorkers} , name, image_id, count, instance_type, user, zone, project, cluster_nodes, features) =
102- GCPPeerWorkers (name, image_id, count, instance_type, user, zone, project, cluster_nodes, features)
108+ gcp_build_clusterobj (_:: Type{<:PeerWorkers} , name, image_id, count, instance_type, user, zone, project, network_interface, cluster_nodes, features) =
109+ GCPPeerWorkers (name, image_id, count, instance_type, user, zone, project, network_interface, cluster_nodes, features)
103110
104- gcp_build_clusterobj (_:: Type{<:PeerWorkersMPI} , name, image_id, count, instance_type, user, zone, project, cluster_nodes, features) =
105- GCPPeerWorkersMPI (name, image_id, count, instance_type, user, zone, project, cluster_nodes, features)
111+ gcp_build_clusterobj (_:: Type{<:PeerWorkersMPI} , name, image_id, count, instance_type, user, zone, project, network_interface, cluster_nodes, features) =
112+ GCPPeerWorkersMPI (name, image_id, count, instance_type, user, zone, project, network_interface, cluster_nodes, features)
106113
107114function launch_processes (_:: Type{GoogleCloud} , cluster_type:: Type{<:Cluster} , cluster_handle, ips)
108115 cluster = gcp_cluster_info[cluster_handle]
@@ -151,4 +158,27 @@ function cluster_isrunning(_::Type{GoogleCloud}, cluster_handle)
151158 @warn " Erro ao verificar o status do cluster: " , e
152159 return false
153160 end
161+ end
162+
163+
164+ function cluster_status (_:: Type{GoogleCloud} , cluster_handle)
165+ cluster = gcp_cluster_info[cluster_handle]
166+ cluster_nodes = cluster. cluster_nodes
167+ error = false
168+ cluster_status = nothing
169+ for (nodeid,instanceid) in cluster_nodes
170+ node_status = gcp_get_instance_status (cluster, instanceid)
171+ @info " $nodeid ($instanceid ) is $node_status "
172+ error = ! isnothing (cluster_status) && cluster_status != node_status
173+ cluster_status = node_status
174+ end
175+ if error
176+ @error " The GCP cluster is in a inconsistent status (all nodes must be in the same status)"
177+ else
178+ @info " The cluster $cluster_handle at GCP is in $cluster_status status"
179+ end
180+ end
181+
182+ function cluster_delete (_:: Type{GoogleCloud} , cluster_handle)
183+ gcp_delete_cluster (cluster_handle)
154184end
0 commit comments