Class: OSC::Reservations::Adapters::OSCMoab

Inherits:
OSC::Reservations::Adapter show all
Defined in:
lib/osc/reservations/adapters/osc_moab.rb

Overview

This adapter is designed for OSC systems using the Moab scheduler. This adapter requires the parameters torque_name and mrsvctl in the Batch object to work. Only tested on Torque >4.

Defined Under Namespace

Classes: CommandLineError

Instance Method Summary collapse

Methods inherited from OSC::Reservations::Adapter

#initialize

Constructor Details

This class inherits a constructor from OSC::Reservations::Adapter

Instance Method Details

#query_reservation(batch, id) ⇒ Reservation?

Queries the batch server for a given reservation.

Parameters:

  • batch (Batch)

    The batch server to query for the reservation.

  • id (String)

    The ID of the reservation.

Returns:

Raises:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/osc/reservations/adapters/osc_moab.rb', line 20

def query_reservation(batch, id)
  cmd = "#{batch.mrsvctl} --host=#{batch.server} -q #{id} --xml"
  begin
    xml = get_xml(cmd, batch)
  rescue CommandLineError
    return
  end

  r_xml = xml.xpath("//rsv")
  rsv = parse_rsv(r_xml)
  query_nodes(rsv, batch)
  query_node_users(rsv, batch)

  rsv
end

#query_reservations(batch) ⇒ Array<Reservation>

Queries the batch server for a list of reservations.

Parameters:

  • batch (Batch)

    The batch server to query for the reservation.

Returns:

Raises:



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/osc/reservations/adapters/osc_moab.rb', line 40

def query_reservations(batch)
  cmd = "#{batch.mrsvctl} --host=#{batch.server} -q ALL --xml"
  xml = get_xml(cmd, batch)
  xml = filter(xml) # filter out "fake" reservations

  rsv_list = []
  xml.xpath("//rsv").each do |r_xml|
    rsv_list << parse_rsv(r_xml)
  end
  query_nodes(rsv_list, batch)
  query_node_users(rsv_list, batch)

  rsv_list
end

#submit_reservation(batch, reservation) ⇒ Reservation

Submits a given reservation to the batch server.

Parameters:

  • batch (Batch)

    The batch server to submit the reservation at.

  • reservation (Reservation)

    A reservation with necessary information.

Returns:

Raises:



60
61
# File 'lib/osc/reservations/adapters/osc_moab.rb', line 60

def submit_reservation(batch, reservation)
end