class OSC::Reservations::Reservation
Provides a way for developers to interact with a scheduler independent reservation.
Attributes
@return [String] The accounting creds user (who gets charged for unused resources).
@return [Time] The time when this reservation ends.
@return [String] The ID for this reservation.
@return [Array<Node>] The list of nodes reserved under this reservation.
@return [Time] The time when this reservation begins.
@return [Array<String>] The list of users who have access to this reservation.
Public Class Methods
@param opts [Hash] The options to create a reservation with. @option opts [String] :id The ID of the reservation. @option opts [Time] :starttime The time the reservations begins. @option opts [Time] :endtime The time the reservation ends. @option opts [Array<Node>] :nodes An array of nodes allocated for the reservation. @option opts [String] :auser The accounting user to be charged for unused CPU of reservation. @option opts [Array<String>] :users An array of users who have access to this reservation.
# 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
Public Instance Methods
List of nodes that are free to use for this reservation. @return [Array<Node>] The list of nodes free to use.
# File lib/osc/reservations/reservation.rb, line 42 def free_nodes nodes.select(&:free?) end
Has this reservation started yet? @return [Boolean] Whether this reservation has started yet.
# File lib/osc/reservations/reservation.rb, line 48 def started? Time.now >= starttime end