Skip to content

Commit ae2fd51

Browse files
Alberto Jesus Gutierrez JuanesAlberto Jesus Gutierrez Juanes
Alberto Jesus Gutierrez Juanes
authored and
Alberto Jesus Gutierrez Juanes
committed
scheduler
1 parent 548ad96 commit ae2fd51

File tree

4 files changed

+558
-2
lines changed

4 files changed

+558
-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,279 @@
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+
"absoluteCapacity" => 3.15,
37+
"absoluteMaxCapacity" => 25.0,
38+
"absoluteUsedCapacity" => 0.0,
39+
"capacity" => 30.000002,
40+
"maxCapacity" => 50.0,
41+
"numApplications" => 0,
42+
"queueName" => "a1",
43+
"queues" => {
44+
"queue" => [
45+
{
46+
"absoluteCapacity" => 2.6775,
47+
"absoluteMaxCapacity" => 25.0,
48+
"absoluteUsedCapacity" => 0.0,
49+
"capacity" => 85.0,
50+
"maxActiveApplications" => 1,
51+
"maxActiveApplicationsPerUser" => 1,
52+
"maxApplications" => 267,
53+
"maxApplicationsPerUser" => 267,
54+
"maxCapacity" => 100.0,
55+
"numActiveApplications" => 0,
56+
"numApplications" => 0,
57+
"numContainers" => 0,
58+
"numPendingApplications" => 0,
59+
"queueName" => "a1a",
60+
"resourcesUsed" => {
61+
"memory" => 0,
62+
"vCores" => 0
63+
},
64+
"state" => "RUNNING",
65+
"type" => "capacitySchedulerLeafQueueInfo",
66+
"usedCapacity" => 0.0,
67+
"usedResources" => "<memory:0, vCores:0>",
68+
"userLimit" => 100,
69+
"userLimitFactor" => 1.0,
70+
"users" => null
71+
},
72+
{
73+
"absoluteCapacity" => 0.47250003,
74+
"absoluteMaxCapacity" => 25.0,
75+
"absoluteUsedCapacity" => 0.0,
76+
"capacity" => 15.000001,
77+
"maxActiveApplications" => 1,
78+
"maxActiveApplicationsPerUser" => 1,
79+
"maxApplications" => 47,
80+
"maxApplicationsPerUser" => 47,
81+
"maxCapacity" => 100.0,
82+
"numActiveApplications" => 0,
83+
"numApplications" => 0,
84+
"numContainers" => 0,
85+
"numPendingApplications" => 0,
86+
"queueName" => "a1b",
87+
"resourcesUsed" => {
88+
"memory" => 0,
89+
"vCores" => 0
90+
},
91+
"state" => "RUNNING",
92+
"type" => "capacitySchedulerLeafQueueInfo",
93+
"usedCapacity" => 0.0,
94+
"usedResources" => "<memory:0, vCores:0>",
95+
"userLimit" => 100,
96+
"userLimitFactor" => 1.0,
97+
"users" => null
98+
}
99+
]
100+
},
101+
"resourcesUsed" => {
102+
"memory" => 0,
103+
"vCores" => 0
104+
},
105+
"state" => "RUNNING",
106+
"usedCapacity" => 0.0,
107+
"usedResources" => "<memory:0, vCores:0>"
108+
},
109+
{
110+
"absoluteCapacity" => 7.35,
111+
"absoluteMaxCapacity" => 50.0,
112+
"absoluteUsedCapacity" => 0.0,
113+
"capacity" => 70.0,
114+
"maxActiveApplications" => 1,
115+
"maxActiveApplicationsPerUser" => 100,
116+
"maxApplications" => 735,
117+
"maxApplicationsPerUser" => 73500,
118+
"maxCapacity" => 100.0,
119+
"numActiveApplications" => 0,
120+
"numApplications" => 0,
121+
"numContainers" => 0,
122+
"numPendingApplications" => 0,
123+
"queueName" => "a2",
124+
"resourcesUsed" => {
125+
"memory" => 0,
126+
"vCores" => 0
127+
},
128+
"state" => "RUNNING",
129+
"type" => "capacitySchedulerLeafQueueInfo",
130+
"usedCapacity" => 0.0,
131+
"usedResources" => "<memory:0, vCores:0>",
132+
"userLimit" => 100,
133+
"userLimitFactor" => 100.0,
134+
"users" => null
135+
}
136+
]
137+
},
138+
"resourcesUsed" => {
139+
"memory" => 0,
140+
"vCores" => 0
141+
},
142+
"state" => "RUNNING",
143+
"usedCapacity" => 0.0,
144+
"usedResources" => "<memory:0, vCores:0>"
145+
},
146+
{
147+
"absoluteCapacity" => 89.5,
148+
"absoluteMaxCapacity" => 100.0,
149+
"absoluteUsedCapacity" => 0.0,
150+
"capacity" => 89.5,
151+
"maxCapacity" => 100.0,
152+
"numApplications" => 2,
153+
"queueName" => "b",
154+
"queues" => {
155+
"queue" => [
156+
{
157+
"absoluteCapacity" => 53.7,
158+
"absoluteMaxCapacity" => 100.0,
159+
"absoluteUsedCapacity" => 0.0,
160+
"capacity" => 60.000004,
161+
"maxActiveApplications" => 1,
162+
"maxActiveApplicationsPerUser" => 100,
163+
"maxApplications" => 5370,
164+
"maxApplicationsPerUser" => 537000,
165+
"maxCapacity" => 100.0,
166+
"numActiveApplications" => 1,
167+
"numApplications" => 2,
168+
"numContainers" => 0,
169+
"numPendingApplications" => 1,
170+
"queueName" => "b1",
171+
"resourcesUsed" => {
172+
"memory" => 0,
173+
"vCores" => 0
174+
},
175+
"state" => "RUNNING",
176+
"type" => "capacitySchedulerLeafQueueInfo",
177+
"usedCapacity" => 0.0,
178+
"usedResources" => "<memory:0, vCores:0>",
179+
"userLimit" => 100,
180+
"userLimitFactor" => 100.0,
181+
"users" => {
182+
"user" => [
183+
{
184+
"numActiveApplications" => 0,
185+
"numPendingApplications" => 1,
186+
"resourcesUsed" => {
187+
"memory" => 0,
188+
"vCores" => 0
189+
},
190+
"username" => "user2"
191+
},
192+
{
193+
"numActiveApplications" => 1,
194+
"numPendingApplications" => 0,
195+
"resourcesUsed" => {
196+
"memory" => 0,
197+
"vCores" => 0
198+
},
199+
"username" => "user1"
200+
}
201+
]
202+
}
203+
},
204+
{
205+
"absoluteCapacity" => 35.3525,
206+
"absoluteMaxCapacity" => 100.0,
207+
"absoluteUsedCapacity" => 0.0,
208+
"capacity" => 39.5,
209+
"maxActiveApplications" => 1,
210+
"maxActiveApplicationsPerUser" => 100,
211+
"maxApplications" => 3535,
212+
"maxApplicationsPerUser" => 353500,
213+
"maxCapacity" => 100.0,
214+
"numActiveApplications" => 0,
215+
"numApplications" => 0,
216+
"numContainers" => 0,
217+
"numPendingApplications" => 0,
218+
"queueName" => "b2",
219+
"resourcesUsed" => {
220+
"memory" => 0,
221+
"vCores" => 0
222+
},
223+
"state" => "RUNNING",
224+
"type" => "capacitySchedulerLeafQueueInfo",
225+
"usedCapacity" => 0.0,
226+
"usedResources" => "<memory:0, vCores:0>",
227+
"userLimit" => 100,
228+
"userLimitFactor" => 100.0,
229+
"users" => null
230+
},
231+
{
232+
"absoluteCapacity" => 0.4475,
233+
"absoluteMaxCapacity" => 100.0,
234+
"absoluteUsedCapacity" => 0.0,
235+
"capacity" => 0.5,
236+
"maxActiveApplications" => 1,
237+
"maxActiveApplicationsPerUser" => 100,
238+
"maxApplications" => 44,
239+
"maxApplicationsPerUser" => 4400,
240+
"maxCapacity" => 100.0,
241+
"numActiveApplications" => 0,
242+
"numApplications" => 0,
243+
"numContainers" => 0,
244+
"numPendingApplications" => 0,
245+
"queueName" => "b3",
246+
"resourcesUsed" => {
247+
"memory" => 0,
248+
"vCores" => 0
249+
},
250+
"state" => "RUNNING",
251+
"type" => "capacitySchedulerLeafQueueInfo",
252+
"usedCapacity" => 0.0,
253+
"usedResources" => "<memory:0, vCores:0>",
254+
"userLimit" => 100,
255+
"userLimitFactor" => 100.0,
256+
"users" => null
257+
}
258+
]
259+
},
260+
"resourcesUsed" => {
261+
"memory" => 0,
262+
"vCores" => 0
263+
},
264+
"state" => "RUNNING",
265+
"usedCapacity" => 0.0,
266+
"usedResources" => "<memory:0, vCores:0>"
267+
}
268+
]
269+
},
270+
"type" => "capacityScheduler",
271+
"usedCapacity" => 0.0
272+
}
273+
}
274+
response
275+
end
276+
end
277+
end
278+
end
279+
end

0 commit comments

Comments
 (0)