Class: OSC::Reservations::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/osc/reservations/node.rb

Overview

Provides a way for the developer to view the properties of any given reserved node.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Node

Returns a new instance of Node.

Parameters:

  • opts (Hash)

    Options used to create a node.

Options Hash (opts):

  • :id (String)

    The ID of this node.

  • :np (Fixnum)

    The number of processors on this node.

  • :props (Array<String>)

    An array of properties for this node.

  • :jobs (Array<String>)

    An array of job IDs running on this node.

  • :users (Array<String>)

    An array of users running on this node.



27
28
29
30
31
32
33
# File 'lib/osc/reservations/node.rb', line 27

def initialize(opts)
  @id    = opts[:id]
  @np    = opts[:np]
  @props = opts[:props]
  @jobs  = opts[:jobs]
  @users = opts[:users]
end

Instance Attribute Details

#idString

Returns The ID of this node.

Returns:

  • (String)

    The ID of this node.



7
8
9
# File 'lib/osc/reservations/node.rb', line 7

def id
  @id
end

#jobsArray<String>

Returns A list of job id’s running on this node.

Returns:

  • (Array<String>)

    A list of job id’s running on this node.



16
17
18
# File 'lib/osc/reservations/node.rb', line 16

def jobs
  @jobs
end

#npFixnum

Returns Number of cores on this node.

Returns:

  • (Fixnum)

    Number of cores on this node.



10
11
12
# File 'lib/osc/reservations/node.rb', line 10

def np
  @np
end

#propsArray<String>

Returns A list of properties for this node.

Returns:

  • (Array<String>)

    A list of properties for this node.



13
14
15
# File 'lib/osc/reservations/node.rb', line 13

def props
  @props
end

#usersArray<String>

Returns A list of users running on this node.

Returns:

  • (Array<String>)

    A list of users running on this node.



19
20
21
# File 'lib/osc/reservations/node.rb', line 19

def users
  @users
end

Instance Method Details

#free?Boolean

Is this node free to use?

Returns:

  • (Boolean)

    is node free?



37
38
39
# File 'lib/osc/reservations/node.rb', line 37

def free?
  jobs.empty?
end