-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alberto Jesus Gutierrez Juanes
authored and
Alberto Jesus Gutierrez Juanes
committed
May 29, 2017
1 parent
548ad96
commit a714005
Showing
4 changed files
with
558 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.