Repository is archived
No commit activity in last 3 years
No release in over 3 years
Library that queries a cluster for active reservations of the current user.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.7
~> 0.10
~> 10.0

Runtime

~> 0.0
~> 2.0
 Project Readme

OodReservations

Library that queries a cluster for active reservations of the current user.

Installation

Add this line to your application's Gemfile:

gem 'ood_reservations'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ood_reservations

Usage

Given an OodCluster::Cluster object you can build a query object that can query all reservations on the cluster or a specified reservation id:

# Create a query object (creates a TorqueMoab query object)
query = OodReservations::Query.build(cluster: my_torque_moab_cluster)
#=> #<OodReservations::Queries::TorqueMoab>

# Create a query object (this cluster has no scheduler to query)
query = OodReservations::Query.build(cluster: my_cluster_w_no_scheduler)
#=> nil

To query reservations:

# Query all reservations you have on that cluster
rsvs = query.reservations
#=>
#[
#  #<OodReservations::Reservation>,
#  #<OodReservations::Reservation>
#]

# Query for unique reservation id
my_rsv = query.reservation(id: 'my_rsv.23874')
#=> #<OodReservations::Reservation>

An OodReservations::Reservation object has information about the given reservation:

# Has this reservation started yet?
my_rsv.has_started?
#=> true

# Has this reservation ended yet?
my_rsv.has_ended?
#=> false

# Get list of users/groups that have access to this reservation
my_rsv.users.map(&:name)
#=> ["bob", "sally", "me"]

my_rsv.groups.map(&:name)
#=> ["group1", "group2"]

# List all nodes on reservation
my_rsv.nodes.map(&:id)
#=> ["n0001", "n0002"]

# List nodes that have no jobs running on them
my_rsv.free_nodes.map(&:id)
#=> ["n0002"]

Contributing

  1. Fork it ( https://github.com/[my-github-username]/ood_reservations/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request