Sha256: 90bef92da8c1bc8947afba71a00d85b6507f1c84ab962cdb2e1b6789156d5de3

Contents?: true

Size: 694 Bytes

Versions: 3

Compression:

Stored size: 694 Bytes

Contents

module OffTheGrid
  # A class to represent SGE Host Groups
  class HostGroup < NamedResource
    # Get the list of SGE host groups
    def self.list
      `qconf -shgrpl`.chomp.split("\n").sort.collect { |name| new(name) }
    end

    def details
      `qconf -shgrp #{name}`.chomp
    end

    def as_tree
      `qconf -shgrp_tree #{name}`.chomp
    end

    def hosts
      extract_detail(:hostlist).map { |host| ExecuteHost.new(host) }
    end

    # TODO: Adding a Host to a HostGroup...

    private

    # Add an SGE host group
    def add
      system("qconf -ahgrp #{name}")
    end

    # Remove an SGE host group
    def remove
      system("qconf -dhgrp #{name}")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
off_the_grid-0.0.6 lib/off_the_grid/host_group.rb
off_the_grid-0.0.5 lib/off_the_grid/host_group.rb
off_the_grid-0.0.4 lib/off_the_grid/host_group.rb