class Fog::Compute::Hadoop::Mock
Public Class Methods
new(options = {})
click to toggle source
# File lib/fog/hadoop/compute.rb, line 29 def initialize(options = {}) @compute_api_url = options[:hadoop_compute_api_url] || 'https://localhost:8088/' end
Public Instance Methods
get_app_stats()
click to toggle source
# File lib/fog/hadoop/requests/compute/get_app_stats.rb, line 14 def get_app_stats response = Excon::Response.new response.status = 200 response.body = [ { "state" => "accepted", "type" => "mapreduce", "count" => 4 }, { "state" => "running", "type" => "mapreduce", "count" => 1 }, { "state" => "finished", "type" => "mapreduce", "count" => 7 } ] response end
get_app_stats_detail(options = {})
click to toggle source
# File lib/fog/hadoop/requests/compute/get_app_stats_detail.rb, line 14 def get_app_stats_detail(options = {}) response = Excon::Response.new response.status = 200 response.body = [ { "state" => "accepted", "type" => "mapreduce", "count" => 4 } ] response end
get_info()
click to toggle source
# File lib/fog/hadoop/requests/compute/get_info.rb, line 14 def get_info response = Excon::Response.new response.status = 200 response.body = { "id" => 1324053971963, "startedOn" => 1324053971963, "state" => "STARTED", "resourceManagerVersion" => "0.23.1-SNAPSHOT", "resourceManagerBuildVersion" => "0.23.1-SNAPSHOT from 1214049 by user1"\ " source checksum 050cd664439d931c8743a6428fd6a693", "resourceManagerVersionBuiltOn" => "Tue Dec 13 22:12:48 CST 2011", "hadoopVersion" => "0.23.1-SNAPSHOT", "hadoopBuildVersion" => "0.23.1-SNAPSHOT from 1214049 by user1"\ " source checksum 11458df3bb77342dca5f917198fad328", "hadoopVersionBuiltOn" => "Tue Dec 13 22:12:26 CST 2011" } response end
get_metrics()
click to toggle source
# File lib/fog/hadoop/requests/compute/get_metrics.rb, line 14 def get_metrics response = Excon::Response.new response.status = 200 response.body = { "appsSubmitted" => 0, "appsCompleted" => 0, "appsPending" => 0, "appsRunning" => 0, "appsFailed" => 0, "appsKilled" => 0, "reservedMB" => 0, "availableMB" => 17408, "allocatedMB" => 0, "reservedVirtualCores" => 0, "availableVirtualCores" => 7, "allocatedVirtualCores" => 1, "containersAllocated" => 0, "containersReserved" => 0, "containersPending" => 0, "totalMB" => 17408, "totalVirtualCores" => 8, "totalNodes" => 1, "lostNodes" => 0, "unhealthyNodes" => 0, "decommissionedNodes" => 0, "rebootedNodes" => 0, "activeNodes" => 1 } response end
get_node(node_ref)
click to toggle source
# File lib/fog/hadoop/requests/compute/get_node.rb, line 14 def get_node(node_ref) response = Excon::Response.new response.status = 200 response.body = { "rack" => "\/default-rack", "state" => "NEW", "id" => "h2:1235", "nodeHostName" => "h2", "nodeHTTPAddress" => "h2:2", "healthStatus" => "Healthy", "lastHealthUpdate" => 1324056895432, "healthReport" => "Healthy", "numContainers" => 0, "usedMemoryMB" => 0, "availMemoryMB" => 5120, "usedVirtualCores" => 0, "availableVirtualCores" => 8 } response end
list_nodes()
click to toggle source
# File lib/fog/hadoop/requests/compute/list_nodes.rb, line 14 def list_nodes response = Excon::Response.new response.status = 200 response.body = [ { "rack" => "\/default-rack", "state" => "NEW", "id" => "h2:1235", "nodeHostName" => "h2", "nodeHTTPAddress" => "h2:2", "healthStatus" => "Healthy", "lastHealthUpdate" => 1324056895432, "healthReport" => "Healthy", "numContainers" => 0, "usedMemoryMB" => 0, "availMemoryMB" => 8192, "usedVirtualCores" => 0, "availableVirtualCores" => 8 }, { "rack" => "\/default-rack", "state" => "NEW", "id" => "h1:1234", "nodeHostName" => "h1", "nodeHTTPAddress" => "h1:2", "healthStatus" => "Healthy", "lastHealthUpdate" => 1324056895092, "healthReport" => "Healthy", "numContainers" => 0, "usedMemoryMB" => 0, "availMemoryMB" => 8192, "usedVirtualCores" => 0, "availableVirtualCores" => 8 } ] response end