Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scheduler #12

Merged
merged 1 commit into from
May 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
222 changes: 222 additions & 0 deletions lib/fog/hadoop/requests/compute/get_scheduler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
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",
"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