Class: OSC::Reservations::Reservation
- Inherits:
-
Object
- Object
- OSC::Reservations::Reservation
- Defined in:
- lib/osc/reservations/reservation.rb
Overview
Provides a way for developers to interact with a scheduler independent reservation.
Instance Attribute Summary collapse
-
#auser ⇒ String
The accounting creds user (who gets charged for unused resources).
-
#endtime ⇒ Time
The time when this reservation ends.
-
#id ⇒ String
The ID for this reservation.
-
#nodes ⇒ Array<Node>
The list of nodes reserved under this reservation.
-
#starttime ⇒ Time
The time when this reservation begins.
-
#users ⇒ Array<String>
The list of users who have access to this reservation.
Instance Method Summary collapse
-
#free_nodes ⇒ Array<Node>
List of nodes that are free to use for this reservation.
-
#initialize(opts) ⇒ Reservation
constructor
A new instance of Reservation.
-
#started? ⇒ Boolean
Has this reservation started yet?.
Constructor Details
#initialize(opts) ⇒ Reservation
Returns a new instance of Reservation.
31 32 33 34 35 36 37 38 |
# File 'lib/osc/reservations/reservation.rb', line 31 def initialize(opts) @id = opts[:id] @starttime = opts[:starttime] @endtime = opts[:endtime] @nodes = opts[:nodes] @auser = opts[:auser] @users = opts[:users] end |
Instance Attribute Details
#auser ⇒ String
Returns The accounting creds user (who gets charged for unused resources).
19 20 21 |
# File 'lib/osc/reservations/reservation.rb', line 19 def auser @auser end |
#endtime ⇒ Time
Returns The time when this reservation ends.
13 14 15 |
# File 'lib/osc/reservations/reservation.rb', line 13 def endtime @endtime end |
#id ⇒ String
Returns The ID for this reservation.
7 8 9 |
# File 'lib/osc/reservations/reservation.rb', line 7 def id @id end |
#nodes ⇒ Array<Node>
Returns The list of nodes reserved under this reservation.
16 17 18 |
# File 'lib/osc/reservations/reservation.rb', line 16 def nodes @nodes end |
#starttime ⇒ Time
Returns The time when this reservation begins.
10 11 12 |
# File 'lib/osc/reservations/reservation.rb', line 10 def starttime @starttime end |
#users ⇒ Array<String>
Returns The list of users who have access to this reservation.
22 23 24 |
# File 'lib/osc/reservations/reservation.rb', line 22 def users @users end |
Instance Method Details
#free_nodes ⇒ Array<Node>
List of nodes that are free to use for this reservation.
42 43 44 |
# File 'lib/osc/reservations/reservation.rb', line 42 def free_nodes nodes.select(&:free?) end |
#started? ⇒ Boolean
Has this reservation started yet?
48 49 50 |
# File 'lib/osc/reservations/reservation.rb', line 48 def started? Time.now >= starttime end |