Class: Pwrake::HostInfo
- Inherits:
-
Object
- Object
- Pwrake::HostInfo
- Defined in:
- lib/pwrake/option/host_map.rb
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#idle_cores ⇒ Object
Returns the value of attribute idle_cores.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ncore ⇒ Object
readonly
Returns the value of attribute ncore.
-
#steal_flag ⇒ Object
readonly
Returns the value of attribute steal_flag.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
- #decrease(n) ⇒ Object
- #increase(n) ⇒ Object
-
#initialize(name, id, ncore, weight, group = nil) ⇒ HostInfo
constructor
A new instance of HostInfo.
- #set_ncore(n) ⇒ Object
- #steal_phase ⇒ Object
Constructor Details
#initialize(name, id, ncore, weight, group = nil) ⇒ HostInfo
Returns a new instance of HostInfo.
5 6 7 8 9 10 11 |
# File 'lib/pwrake/option/host_map.rb', line 5 def initialize(name,id,ncore,weight,group=nil) @name = name @ncore = ncore @weight = weight || 1.0 @group = group || 0 @id = id end |
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
13 14 15 |
# File 'lib/pwrake/option/host_map.rb', line 13 def group @group end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
13 14 15 |
# File 'lib/pwrake/option/host_map.rb', line 13 def id @id end |
#idle_cores ⇒ Object
Returns the value of attribute idle_cores.
14 15 16 |
# File 'lib/pwrake/option/host_map.rb', line 14 def idle_cores @idle_cores end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/pwrake/option/host_map.rb', line 13 def name @name end |
#ncore ⇒ Object (readonly)
Returns the value of attribute ncore.
13 14 15 |
# File 'lib/pwrake/option/host_map.rb', line 13 def ncore @ncore end |
#steal_flag ⇒ Object (readonly)
Returns the value of attribute steal_flag.
13 14 15 |
# File 'lib/pwrake/option/host_map.rb', line 13 def steal_flag @steal_flag end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
13 14 15 |
# File 'lib/pwrake/option/host_map.rb', line 13 def weight @weight end |
Instance Method Details
#decrease(n) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/pwrake/option/host_map.rb', line 24 def decrease(n) @idle_cores -= n if @idle_cores < 0 raise RuntimeError,"# of cores must be non-negative" end end |
#increase(n) ⇒ Object
20 21 22 |
# File 'lib/pwrake/option/host_map.rb', line 20 def increase(n) @idle_cores += n end |
#set_ncore(n) ⇒ Object
16 17 18 |
# File 'lib/pwrake/option/host_map.rb', line 16 def set_ncore(n) @ncore = @idle_cores = n end |
#steal_phase ⇒ Object
31 32 33 34 35 36 |
# File 'lib/pwrake/option/host_map.rb', line 31 def steal_phase @steal_flag = true t = yield(self) @steal_flag = false t end |