Skip to content

Commit

Permalink
scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Jesus Gutierrez Juanes authored and Alberto Jesus Gutierrez Juanes committed May 29, 2017
1 parent 548ad96 commit a714005
Show file tree
Hide file tree
Showing 4 changed files with 558 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# fog-hadoop
[![Build Status](https://travis-ci.org/fog/fog-hadoop.svg?branch=master)](https://travis-ci.org/fog/fog-hadoop) [![Code Climate](https://lima.codeclimate.com/github/fog/fog-hadoop/badges/gpa.svg)](https://lima.codeclimate.com/github/fog/fog-hadoop) [![Test Coverage](https://lima.codeclimate.com/github/fog/fog-hadoop/badges/coverage.svg)](https://lima.codeclimate.com/github/fog/fog-hadoop/coverage)
[![Gem Version](https://badge.fury.io/rb/fog-hadoop.svg)](https://badge.fury.io/rb/fog-hadoop)[![Build Status](https://travis-ci.org/fog/fog-hadoop.svg?branch=master)](https://travis-ci.org/fog/fog-hadoop) [![Code Climate](https://lima.codeclimate.com/github/fog/fog-hadoop/badges/gpa.svg)](https://lima.codeclimate.com/github/fog/fog-hadoop) [![Test Coverage](https://lima.codeclimate.com/github/fog/fog-hadoop/badges/coverage.svg)](https://lima.codeclimate.com/github/fog/fog-hadoop/coverage)

## Fog connector for Hadoop

Expand Down Expand Up @@ -44,7 +44,7 @@ Connection parameters:
Check in this [link](supported.md)

# Contribute
Read the [contribute](docs/CONTRIBUTING.md) documentation
Read the [contribute](CONTRIBUTING.md) documentation

# Development

Expand Down
1 change: 1 addition & 0 deletions lib/fog/hadoop/compute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Hadoop < Fog::Service

request_path 'fog/hadoop/requests/compute'
request :get_info
request :get_scheduler
request :get_app_stats
request :get_app_stats_detail
request :get_metrics
Expand Down
279 changes: 279 additions & 0 deletions lib/fog/hadoop/requests/compute/get_scheduler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
module Fog
module Compute
class Hadoop
class Real
def get_scheduler
request(
:expects => 200,
:method => 'GET',
:path => "#{Fog::Hadoop.yarn_endpoint}/scheduler"
).body["scheduler"]
end
end
class Mock
def get_scheduler
response = Excon::Response.new
response.status = 200
response.body =
{
"schedulerInfo" => {
"capacity" => 100.0,
"maxCapacity" => 100.0,
"queueName" => "root",
"queues" => {
"queue" => [
{
"absoluteCapacity" => 10.5,
"absoluteMaxCapacity" => 50.0,
"absoluteUsedCapacity" => 0.0,
"capacity" => 10.5,
"maxCapacity" => 50.0,
"numApplications" => 0,
"queueName" => "a",
"queues" => {
"queue" => [
{
"absoluteCapacity" => 3.15,
"absoluteMaxCapacity" => 25.0,
"absoluteUsedCapacity" => 0.0,
"capacity" => 30.000002,
"maxCapacity" => 50.0,
"numApplications" => 0,
"queueName" => "a1",
"queues" => {
"queue" => [
{
"absoluteCapacity" => 2.6775,
"absoluteMaxCapacity" => 25.0,
"absoluteUsedCapacity" => 0.0,
"capacity" => 85.0,
"maxActiveApplications" => 1,
"maxActiveApplicationsPerUser" => 1,
"maxApplications" => 267,
"maxApplicationsPerUser" => 267,
"maxCapacity" => 100.0,
"numActiveApplications" => 0,
"numApplications" => 0,
"numContainers" => 0,
"numPendingApplications" => 0,
"queueName" => "a1a",
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"state" => "RUNNING",
"type" => "capacitySchedulerLeafQueueInfo",
"usedCapacity" => 0.0,
"usedResources" => "<memory:0, vCores:0>",
"userLimit" => 100,
"userLimitFactor" => 1.0,
"users" => nil
},
{
"absoluteCapacity" => 0.47250003,
"absoluteMaxCapacity" => 25.0,
"absoluteUsedCapacity" => 0.0,
"capacity" => 15.000001,
"maxActiveApplications" => 1,
"maxActiveApplicationsPerUser" => 1,
"maxApplications" => 47,
"maxApplicationsPerUser" => 47,
"maxCapacity" => 100.0,
"numActiveApplications" => 0,
"numApplications" => 0,
"numContainers" => 0,
"numPendingApplications" => 0,
"queueName" => "a1b",
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"state" => "RUNNING",
"type" => "capacitySchedulerLeafQueueInfo",
"usedCapacity" => 0.0,
"usedResources" => "<memory:0, vCores:0>",
"userLimit" => 100,
"userLimitFactor" => 1.0,
"users" => nil
}
]
},
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"state" => "RUNNING",
"usedCapacity" => 0.0,
"usedResources" => "<memory:0, vCores:0>"
},
{
"absoluteCapacity" => 7.35,
"absoluteMaxCapacity" => 50.0,
"absoluteUsedCapacity" => 0.0,
"capacity" => 70.0,
"maxActiveApplications" => 1,
"maxActiveApplicationsPerUser" => 100,
"maxApplications" => 735,
"maxApplicationsPerUser" => 73500,
"maxCapacity" => 100.0,
"numActiveApplications" => 0,
"numApplications" => 0,
"numContainers" => 0,
"numPendingApplications" => 0,
"queueName" => "a2",
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"state" => "RUNNING",
"type" => "capacitySchedulerLeafQueueInfo",
"usedCapacity" => 0.0,
"usedResources" => "<memory:0, vCores:0>",
"userLimit" => 100,
"userLimitFactor" => 100.0,
"users" => nil
}
]
},
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"state" => "RUNNING",
"usedCapacity" => 0.0,
"usedResources" => "<memory:0, vCores:0>"
},
{
"absoluteCapacity" => 89.5,
"absoluteMaxCapacity" => 100.0,
"absoluteUsedCapacity" => 0.0,
"capacity" => 89.5,
"maxCapacity" => 100.0,
"numApplications" => 2,
"queueName" => "b",
"queues" => {
"queue" => [
{
"absoluteCapacity" => 53.7,
"absoluteMaxCapacity" => 100.0,
"absoluteUsedCapacity" => 0.0,
"capacity" => 60.000004,
"maxActiveApplications" => 1,
"maxActiveApplicationsPerUser" => 100,
"maxApplications" => 5370,
"maxApplicationsPerUser" => 537000,
"maxCapacity" => 100.0,
"numActiveApplications" => 1,
"numApplications" => 2,
"numContainers" => 0,
"numPendingApplications" => 1,
"queueName" => "b1",
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"state" => "RUNNING",
"type" => "capacitySchedulerLeafQueueInfo",
"usedCapacity" => 0.0,
"usedResources" => "<memory:0, vCores:0>",
"userLimit" => 100,
"userLimitFactor" => 100.0,
"users" => {
"user" => [
{
"numActiveApplications" => 0,
"numPendingApplications" => 1,
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"username" => "user2"
},
{
"numActiveApplications" => 1,
"numPendingApplications" => 0,
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"username" => "user1"
}
]
}
},
{
"absoluteCapacity" => 35.3525,
"absoluteMaxCapacity" => 100.0,
"absoluteUsedCapacity" => 0.0,
"capacity" => 39.5,
"maxActiveApplications" => 1,
"maxActiveApplicationsPerUser" => 100,
"maxApplications" => 3535,
"maxApplicationsPerUser" => 353500,
"maxCapacity" => 100.0,
"numActiveApplications" => 0,
"numApplications" => 0,
"numContainers" => 0,
"numPendingApplications" => 0,
"queueName" => "b2",
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"state" => "RUNNING",
"type" => "capacitySchedulerLeafQueueInfo",
"usedCapacity" => 0.0,
"usedResources" => "<memory:0, vCores:0>",
"userLimit" => 100,
"userLimitFactor" => 100.0,
"users" => nil
},
{
"absoluteCapacity" => 0.4475,
"absoluteMaxCapacity" => 100.0,
"absoluteUsedCapacity" => 0.0,
"capacity" => 0.5,
"maxActiveApplications" => 1,
"maxActiveApplicationsPerUser" => 100,
"maxApplications" => 44,
"maxApplicationsPerUser" => 4400,
"maxCapacity" => 100.0,
"numActiveApplications" => 0,
"numApplications" => 0,
"numContainers" => 0,
"numPendingApplications" => 0,
"queueName" => "b3",
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"state" => "RUNNING",
"type" => "capacitySchedulerLeafQueueInfo",
"usedCapacity" => 0.0,
"usedResources" => "<memory:0, vCores:0>",
"userLimit" => 100,
"userLimitFactor" => 100.0,
"users" => nil
}
]
},
"resourcesUsed" => {
"memory" => 0,
"vCores" => 0
},
"state" => "RUNNING",
"usedCapacity" => 0.0,
"usedResources" => "<memory:0, vCores:0>"
}
]
},
"type" => "capacityScheduler",
"usedCapacity" => 0.0
}
}
response
end
end
end
end
end
Loading

0 comments on commit a714005

Please sign in to comment.