Sha256: a4c24a7d7063de9364dc99dab51fb74411ab055771b8a9e15acf3b402196608d

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

#
# Copyright 2012 Mortar Data Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require "mortar/command/base"

# view running and recent clusters
#
class Mortar::Command::Clusters < Mortar::Command::Base
    
  # clusters
  #
  # Display running and recently terminated clusters.
  #
  #Examples:
  #
  # $ mortar clusters
  # 
  #cluster_id                Size (# of Nodes)  Status    Type         Start Timestamp  Elapsed Time
  #------------------------  -----------------  --------  -----------  ---------------  ------------
  #5023ca3ce0c222b7caaa546a                  3  Starting  Multi - Job                   
  #
  def index
    validate_arguments!
    
    clusters = api.get_clusters().body['clusters']
    if not clusters.empty?
      display_table(clusters,
      %w( cluster_id size status_description cluster_type_description start_timestamp duration),
      ['cluster_id', 'Size (# of Nodes)', 'Status', 'Type', 'Start Timestamp', 'Elapsed Time'])
    else
      display("There are no running or recent clusters")
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mortar-0.3.0 lib/mortar/command/clusters.rb
mortar-0.2.1 lib/mortar/command/clusters.rb