Class: Commands::AddInstanceGroupCommand

Inherits:
AbstractInstanceGroupCommand show all
Defined in:
lib/commands.rb

Instance Attribute Summary

Attributes inherited from AbstractInstanceGroupCommand

#instance_count, #instance_group_id, #instance_group_name, #instance_role, #instance_type

Attributes inherited from Command

#arg, #commands, #description, #logger, #name

Instance Method Summary collapse

Methods inherited from AbstractInstanceGroupCommand

#default_instance_group_name, #initialize, #instance_group, #require_singleton_array

Methods inherited from Command

#get_field, #has_value, #have, #initialize, #option, #require, #require_single_jobflow, #resolve

Constructor Details

This class inherits a constructor from Commands::AbstractInstanceGroupCommand

Instance Method Details

#enact(client) ⇒ Object



1096
1097
1098
1099
1100
1101
# File 'lib/commands.rb', line 1096

def enact(client)
  client.add_instance_groups(
    'JobFlowId' => require_single_jobflow, 'InstanceGroups' => [instance_group]
  )
  logger.puts("Added instance group " + get_field(:instance_role))
end

#validateObject



1088
1089
1090
1091
1092
1093
1094
# File 'lib/commands.rb', line 1088

def validate
  if ! ["TASK"].include?(get_field(:instance_role)) then
    raise RuntimeError, "Invalid argument to #{name}, expected 'task'"
  end
  require(:instance_type, "Option #{name} is missing --instance-type")
  require(:instance_count, "Option #{name} is missing --instance-count")
end