Esempio n. 1
0
 def terminate_job_flows(self, job_flow_ids):
     clusters_terminated = []
     clusters_protected = []
     for job_flow_id in job_flow_ids:
         cluster = self.clusters[job_flow_id]
         if cluster.termination_protected:
             clusters_protected.append(cluster)
             continue
         cluster.terminate()
         clusters_terminated.append(cluster)
     if clusters_protected:
         raise ValidationException(
             "Could not shut down one or more job flows since they are termination protected."
         )
     return clusters_terminated
Esempio n. 2
0
 def add_instance_group(self, instance_group):
     if instance_group.role == "MASTER":
         if self.master_instance_group_id:
             raise Exception("Cannot add another master instance group")
         self.master_instance_group_id = instance_group.id
         num_master_nodes = instance_group.num_instances
         if num_master_nodes > 1:
             # Cluster is HA
             if num_master_nodes != 3:
                 raise ValidationException(
                     "Master instance group must have exactly 3 instances for HA clusters."
                 )
             self.keep_job_flow_alive_when_no_steps = True
             self.termination_protected = True
     if instance_group.role == "CORE":
         if self.core_instance_group_id:
             raise Exception("Cannot add another core instance group")
         self.core_instance_group_id = instance_group.id
     self.instance_group_ids.append(instance_group.id)