Skip to content

Commit 33513b2

Browse files
authored
Merge pull request #12 from aljesusg/yarn_scheduler
scheduler
2 parents 548ad96 + aba8b84 commit 33513b2

File tree

4 files changed

+444
-2
lines changed

4 files changed

+444
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# fog-hadoop
2-
[![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)
2+
[![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)
33

44
## Fog connector for Hadoop
55

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

4646
# Contribute
47-
Read the [contribute](docs/CONTRIBUTING.md) documentation
47+
Read the [contribute](CONTRIBUTING.md) documentation
4848

4949
# Development
5050

lib/fog/hadoop/compute.rb

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class Hadoop < Fog::Service
88

99
request_path 'fog/hadoop/requests/compute'
1010
request :get_info
11+
request :get_scheduler
1112
request :get_app_stats
1213
request :get_app_stats_detail
1314
request :get_metrics
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
module Fog
2+
module Compute
3+
class Hadoop
4+
class Real
5+
def get_scheduler
6+
request(
7+
:expects => 200,
8+
:method => 'GET',
9+
:path => "#{Fog::Hadoop.yarn_endpoint}/scheduler"
10+
).body["scheduler"]
11+
end
12+
end
13+
class Mock
14+
def get_scheduler
15+
response = Excon::Response.new
16+
response.status = 200
17+
response.body =
18+
{
19+
"schedulerInfo" => {
20+
"capacity" => 100.0,
21+
"maxCapacity" => 100.0,
22+
"queueName" => "root",
23+
"queues" => {
24+
"queue" => [
25+
{
26+
"absoluteCapacity" => 10.5,
27+
"absoluteMaxCapacity" => 50.0,
28+
"absoluteUsedCapacity" => 0.0,
29+
"capacity" => 10.5,
30+
"maxCapacity" => 50.0,
31+
"numApplications" => 0,
32+
"queueName" => "a",
33+
"queues" => {
34+
"queue" => [
35+
36+
{
37+
"absoluteCapacity" => 3.15,
38+
"absoluteMaxCapacity" => 25.0,
39+
"absoluteUsedCapacity" => 0.0,
40+
"capacity" => 30.000002,
41+
"maxCapacity" => 50.0,
42+
"numApplications" => 0,
43+
"queueName" => "a1",
44+
"resourcesUsed" => {
45+
"memory" => 0,
46+
"vCores" => 0
47+
},
48+
"state" => "RUNNING",
49+
"usedCapacity" => 0.0,
50+
"usedResources" => "<memory:0, vCores:0>"
51+
},
52+
{
53+
"absoluteCapacity" => 7.35,
54+
"absoluteMaxCapacity" => 50.0,
55+
"absoluteUsedCapacity" => 0.0,
56+
"capacity" => 70.0,
57+
"maxActiveApplications" => 1,
58+
"maxActiveApplicationsPerUser" => 100,
59+
"maxApplications" => 735,
60+
"maxApplicationsPerUser" => 73500,
61+
"maxCapacity" => 100.0,
62+
"numActiveApplications" => 0,
63+
"numApplications" => 0,
64+
"numContainers" => 0,
65+
"numPendingApplications" => 0,
66+
"queueName" => "a2",
67+
"resourcesUsed" => {
68+
"memory" => 0,
69+
"vCores" => 0
70+
},
71+
"state" => "RUNNING",
72+
"type" => "capacitySchedulerLeafQueueInfo",
73+
"usedCapacity" => 0.0,
74+
"usedResources" => "<memory:0, vCores:0>",
75+
"userLimit" => 100,
76+
"userLimitFactor" => 100.0,
77+
"users" => nil
78+
}
79+
]
80+
},
81+
"resourcesUsed" => {
82+
"memory" => 0,
83+
"vCores" => 0
84+
},
85+
"state" => "RUNNING",
86+
"usedCapacity" => 0.0,
87+
"usedResources" => "<memory:0, vCores:0>"
88+
},
89+
{
90+
"absoluteCapacity" => 89.5,
91+
"absoluteMaxCapacity" => 100.0,
92+
"absoluteUsedCapacity" => 0.0,
93+
"capacity" => 89.5,
94+
"maxCapacity" => 100.0,
95+
"numApplications" => 2,
96+
"queueName" => "b",
97+
"queues" => {
98+
"queue" => [
99+
{
100+
"absoluteCapacity" => 53.7,
101+
"absoluteMaxCapacity" => 100.0,
102+
"absoluteUsedCapacity" => 0.0,
103+
"capacity" => 60.000004,
104+
"maxActiveApplications" => 1,
105+
"maxActiveApplicationsPerUser" => 100,
106+
"maxApplications" => 5370,
107+
"maxApplicationsPerUser" => 537000,
108+
"maxCapacity" => 100.0,
109+
"numActiveApplications" => 1,
110+
"numApplications" => 2,
111+
"numContainers" => 0,
112+
"numPendingApplications" => 1,
113+
"queueName" => "b1",
114+
"resourcesUsed" => {
115+
"memory" => 0,
116+
"vCores" => 0
117+
},
118+
"state" => "RUNNING",
119+
"type" => "capacitySchedulerLeafQueueInfo",
120+
"usedCapacity" => 0.0,
121+
"usedResources" => "<memory:0, vCores:0>",
122+
"userLimit" => 100,
123+
"userLimitFactor" => 100.0,
124+
"users" => {
125+
"user" => [
126+
{
127+
"numActiveApplications" => 0,
128+
"numPendingApplications" => 1,
129+
"resourcesUsed" => {
130+
"memory" => 0,
131+
"vCores" => 0
132+
},
133+
"username" => "user2"
134+
},
135+
{
136+
"numActiveApplications" => 1,
137+
"numPendingApplications" => 0,
138+
"resourcesUsed" => {
139+
"memory" => 0,
140+
"vCores" => 0
141+
},
142+
"username" => "user1"
143+
}
144+
]
145+
}
146+
},
147+
{
148+
"absoluteCapacity" => 35.3525,
149+
"absoluteMaxCapacity" => 100.0,
150+
"absoluteUsedCapacity" => 0.0,
151+
"capacity" => 39.5,
152+
"maxActiveApplications" => 1,
153+
"maxActiveApplicationsPerUser" => 100,
154+
"maxApplications" => 3535,
155+
"maxApplicationsPerUser" => 353500,
156+
"maxCapacity" => 100.0,
157+
"numActiveApplications" => 0,
158+
"numApplications" => 0,
159+
"numContainers" => 0,
160+
"numPendingApplications" => 0,
161+
"queueName" => "b2",
162+
"resourcesUsed" => {
163+
"memory" => 0,
164+
"vCores" => 0
165+
},
166+
"state" => "RUNNING",
167+
"type" => "capacitySchedulerLeafQueueInfo",
168+
"usedCapacity" => 0.0,
169+
"usedResources" => "<memory:0, vCores:0>",
170+
"userLimit" => 100,
171+
"userLimitFactor" => 100.0,
172+
"users" => nil
173+
},
174+
{
175+
"absoluteCapacity" => 0.4475,
176+
"absoluteMaxCapacity" => 100.0,
177+
"absoluteUsedCapacity" => 0.0,
178+
"capacity" => 0.5,
179+
"maxActiveApplications" => 1,
180+
"maxActiveApplicationsPerUser" => 100,
181+
"maxApplications" => 44,
182+
"maxApplicationsPerUser" => 4400,
183+
"maxCapacity" => 100.0,
184+
"numActiveApplications" => 0,
185+
"numApplications" => 0,
186+
"numContainers" => 0,
187+
"numPendingApplications" => 0,
188+
"queueName" => "b3",
189+
"resourcesUsed" => {
190+
"memory" => 0,
191+
"vCores" => 0
192+
},
193+
"state" => "RUNNING",
194+
"type" => "capacitySchedulerLeafQueueInfo",
195+
"usedCapacity" => 0.0,
196+
"usedResources" => "<memory:0, vCores:0>",
197+
"userLimit" => 100,
198+
"userLimitFactor" => 100.0,
199+
"users" => nil
200+
}
201+
]
202+
},
203+
"resourcesUsed" => {
204+
"memory" => 0,
205+
"vCores" => 0
206+
},
207+
"state" => "RUNNING",
208+
"usedCapacity" => 0.0,
209+
"usedResources" => "<memory:0, vCores:0>"
210+
}
211+
]
212+
},
213+
"type" => "capacityScheduler",
214+
"usedCapacity" => 0.0
215+
}
216+
}
217+
response
218+
end
219+
end
220+
end
221+
end
222+
end

0 commit comments

Comments
 (0)