Class: MintPress::Infrastructure::InstanceType

Inherits:
Object
  • Object
show all
Includes:
MintLogger, Mixins::Properties
Defined in:
src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb

Overview

Class of instance types - subclasses should provide these generally, but they're also used for the specs sub-object

Properties (Read/Write)

  • #name ⇒ String (Default Value: 'Custom Instance')
    Name of the instance - for example, 't3.micro'

    Property Attributes
    • default'Custom Instance'
    
    
    645
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 645
    
    property :name, type: String, default: 'Custom Instance'
  • #instance_type (Default Value: Proc.new { self.name })
    Name of the instance - for example, 't3.micro'

    Property Attributes
    • defaultProc.new { self.name }
    
    
    647
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 647
    
    property :instance_type, default: Proc.new { self.name }
  • #gpu ⇒ [TrueClass, FalseClass] (Default Value: false)
    Does this instance type provide a GPU?

    Property Attributes
    • defaultfalse
    
    
    649
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 649
    
    property :gpu, type: [TrueClass, FalseClass], default: false
  • #io_optimized ⇒ [TrueClass, FalseClass] (Default Value: false)
    Is this instance type IO optimized?

    Property Attributes
    • defaultfalse
    
    
    651
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 651
    
    property :io_optimized, type: [TrueClass, FalseClass], default: false
  • #cpu_optimized ⇒ [TrueClass, FalseClass] (Default Value: false)
    Is this instance type CPU optimized?

    Property Attributes
    • defaultfalse
    
    
    653
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 653
    
    property :cpu_optimized, type: [TrueClass, FalseClass], default: false
  • #ram_optimized ⇒ [TrueClass, FalseClass] (Default Value: false)
    Is this instance type RAM optimized?

    Property Attributes
    • defaultfalse
    
    
    655
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 655
    
    property :ram_optimized, type: [TrueClass, FalseClass], default: false
  • #cpu_count ⇒ Integer
    How many CPUs does this instance type provide?

    Property Attributes
    
    
    658
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 658
    
    property :cpu_count, type: Integer
  • #min_cpu_count ⇒ Integer (Default Value: Proc.new { self.cpu_count })
    If we are searching for an instance type, what is the minimum number of CPUs we will accept (for example: if your cloud provider offers a 32gig ram system that has 4 cpus, but you request 32gig of ram and 6 CPUs, can you accept 4, or do you demand a large instance even though that would have a different RAM match). Default is to match CPU count exactly

    Property Attributes
    • defaultProc.new { self.cpu_count }
    
    
    663
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 663
    
    property :min_cpu_count, type: Integer, default: Proc.new { self.cpu_count }
  • #max_cpu_count ⇒ Integer (Default Value: Proc.new { self.min_cpu_count })
    If we are searching for an instance type, what is the maximum number of CPUs we will accept (for example: if your cloud provider offers a 32gig ram system that has 4 cpus, but you request 32gig of ram and 6 CPUs, can you accept 4, or do you demand a large instance even though that would have a different RAM match). Default is to match CPU count exactly

    Property Attributes
    • defaultProc.new { self.min_cpu_count }
    
    
    668
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 668
    
    property :max_cpu_count, type: Integer, default: Proc.new { self.min_cpu_count }
  • #is_dedicated ⇒ [TrueClass, FalseClass] (Default Value: false)
    Is this a dedicated instance (like the m3.xxx instance on AWS) or is it on shared infrastructure (like the t3.xxx instances)

    Property Attributes
    • defaultfalse
    
    
    670
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 670
    
    property :is_dedicated, type: [TrueClass, FalseClass], default: false
  • #dedicated_only ⇒ [TrueClass, FalseClass] (Default Value: false)
    Will we accept a non-dedicated instance when searching for an instance type match?

    Property Attributes
    • defaultfalse
    
    
    672
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 672
    
    property :dedicated_only, type: [TrueClass, FalseClass], default: false
  • #ram_gb ⇒ Float
    How much ram, in gigabytes does this instance type provide?

    Property Attributes
    
    
    675
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 675
    
    property :ram_gb, type: Float
  • #tolerance_percent ⇒ Integer (Default Value: 25)
    How far, when searching for a matching instance, are we willing to deviate in ram - default is 25%, the idea being that a request for a 32gb instance _should_ match a 30gb/31gb instance type, but _should not_ match a 16gb instane type

    Property Attributes
    • default25
    
    
    678
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 678
    
    property :tolerance_percent, type: Integer, default: 25
  • #min_ram_gb ⇒ Float (Default Value: Proc.new { self.ram_gb - (self.ram_gb * self.tolerance_percent / 100.0) })
    When searching for an instance type, what is the minimum amount of ram we will accept - this defaults to ram-tollerence

    Property Attributes
    • defaultProc.new { self.ram_gb - (self.ram_gb * self.tolerance_percent / 100.0) }
    
    
    680
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 680
    
    property :min_ram_gb, type: Float, default: Proc.new { self.ram_gb - (self.ram_gb * self.tolerance_percent / 100.0) }
  • #max_ram_gb ⇒ Float (Default Value: Proc.new { self.ram_gb + (self.ram_gb * self.tolerance_percent / 100.0) })
    When searching for an instance type, what is the maximum amount of ram we will accept - this defaults to ram+tollerence

    Property Attributes
    • defaultProc.new { self.ram_gb + (self.ram_gb * self.tolerance_percent / 100.0) }
    
    
    682
    # File 'src/mintpress-infrastructure/lib/mintpress-infrastructure/host.rb', line 682
    
    property :max_ram_gb, type: Float, default: Proc.new { self.ram_gb + (self.ram_gb * self.tolerance_percent / 100.0) }

Properties (Read Only)

Constant Summary

Constants included from MintLogger

MintLogger::DEBUG, MintLogger::ERROR, MintLogger::FATAL, MintLogger::INFO, MintLogger::UNKNOWN, MintLogger::VERBOSE, MintLogger::WARN

Instance Attribute Summary

Attributes included from Mixins::Properties

#autopush_set_cache, #dynamic_create, #harvest_on_access, #harvest_undefined_only, #harvested, #tree_root

Instance Method Summary collapse

Methods included from Mixins::Properties

#[], #[]=, #add_validate_report_result, #armour_set_property, #array_contains?, #array_is_a?, #check_autopush, #check_stack_overflow, #clone_property_object, #cloner_handle_single_property, #coerce_single, #contains_as_string?, #display_validate_report_result, #double_initialize?, #dump_to_hash, #find_parent, #find_parent_by_identity, #generate_accessor_functions, #get_canonical_renamed, #get_from_opts, #get_my_name, #get_property, #get_property_item, #has?, included, #initialize_validate_report, #inspect, #is_cloned_object?, #is_mintpress_object?, #is_probably_canonical?, #is_set?, #local_debug, #local_info, #local_verbose, #mintpress_property_definitions, #place_object_by_identity, #process_properties, #prop_set?, #property, #property_definitions, #property_details, #property_is_simple_object?, #push_root!, #require_property, #require_update, #retrieve_docstring, #sanitize, #set_map_dirty, #set_property, #set_property_item, #show_short_array, #strip_defaults!, #synchronize, #uncloned_property_definitions, #update_map, #validate, #validate_generic, #validate_properties, #validate_property, #validate_required, #version_allowed?, #weakref

Methods included from MintLogger::Utils::Common

#boolean_val, #has_value?, #no_value?, #nvl, #path_as_symbol, #ruby_level_to_send

Constructor Details

#initialize(opts = {}) ⇒ InstanceType

Returns a new instance of InstanceType.