Merge lp:~bigdata-dev/charms/trusty/apache-hadoop-yarn-master/trunk into lp:charms/trusty/apache-hadoop-yarn-master
- Trusty Tahr (14.04)
- trunk
- Merge into trunk
Proposed by
amir sanjar
Status: | Merged |
---|---|
Merged at revision: | 87 |
Proposed branch: | lp:~bigdata-dev/charms/trusty/apache-hadoop-yarn-master/trunk |
Merge into: | lp:charms/trusty/apache-hadoop-yarn-master |
Diff against target: |
430 lines (+170/-33) 16 files modified
DEV-README.md (+2/-2) actions.yaml (+6/-0) actions/restart-yarn (+5/-0) actions/start-yarn (+4/-0) actions/stop-yarn (+4/-0) hooks/callbacks.py (+31/-0) hooks/common.py (+30/-10) hooks/config-changed (+11/-0) hooks/install (+11/-0) hooks/namenode-relation-changed (+11/-0) hooks/nodemanager-relation-changed (+11/-0) hooks/resourcemanager-relation-changed (+11/-0) hooks/setup.py (+8/-10) hooks/start (+11/-0) hooks/stop (+11/-0) resources.yaml (+3/-11) |
To merge this branch: | bzr merge lp:~bigdata-dev/charms/trusty/apache-hadoop-yarn-master/trunk |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Kevin W Monroe | Approve | ||
Review via email: mp+262766@code.launchpad.net |
Commit message
Description of the change
adding YARN start, stop, and restart Juju actions to the charm
To post a comment you must log in.
- 89. By Cory Johns
-
Added extended status support
- 90. By Cory Johns
-
Nested python resources to avoid attempting to pip install future non-python resources
- 91. By Cory Johns
-
Register clients as well as slaves to ensure all nodes can communicate
- 92. By Kevin W Monroe
-
update to latest bigdata-data java-installer.sh
- 93. By Kevin W Monroe
-
updated DEV-README to correct historyserver-port description; pass jobhistory port instead of jh_webapp_http for the historyserver-port since related units want to do ipc, not browse. duh.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'DEV-README.md' |
2 | --- DEV-README.md 2015-06-18 17:13:00 +0000 |
3 | +++ DEV-README.md 2015-06-26 22:25:03 +0000 |
4 | @@ -18,7 +18,7 @@ |
5 | * `private-address`: Address of this unit, to provide the ResourceManager |
6 | * `has_slave`: Flag indicating if YARN has at least one NodeManager |
7 | * `port`: Port where the ResourceManager is listening for YARN operations (IPC) |
8 | - * `historyserver-port`: Port for the JobHistory web interface |
9 | + * `historyserver-port`: JobHistory port (IPC) |
10 | |
11 | * Received from the plugin: |
12 | |
13 | @@ -68,7 +68,7 @@ |
14 | * `private-address`: Address of the YARN master unit, to provide the ResourceManager |
15 | * `has_slave`: Flag indicating if YARN has at least one NodeManager |
16 | * `port`: Port where the ResourceManager is listening for YARN operations (IPC) |
17 | - * `historyserver-port`: Port for the JobHistory web interface |
18 | + * `historyserver-port`: JobHistory port (IPC) |
19 | |
20 | * Received from compute-slave: |
21 | |
22 | |
23 | === added directory 'actions' |
24 | === added file 'actions.yaml' |
25 | --- actions.yaml 1970-01-01 00:00:00 +0000 |
26 | +++ actions.yaml 2015-06-26 22:25:03 +0000 |
27 | @@ -0,0 +1,6 @@ |
28 | +start-yarn: |
29 | + description: All of the YARN processes can be started with this Juju action. |
30 | +stop-yarn: |
31 | + description: All of the YARN processes can be stopped with this Juju action. |
32 | +restart-yarn: |
33 | + description: All of the YARN processes can be restarted with this Juju action. |
34 | |
35 | === added file 'actions/restart-yarn' |
36 | --- actions/restart-yarn 1970-01-01 00:00:00 +0000 |
37 | +++ actions/restart-yarn 2015-06-26 22:25:03 +0000 |
38 | @@ -0,0 +1,5 @@ |
39 | +#!/bin/bash |
40 | +. /etc/environment |
41 | +cd ${HADOOP_HOME}/sbin |
42 | +su yarn -c "./stop-yarn.sh" |
43 | +su yarn -c "./start-yarn.sh" |
44 | |
45 | === added file 'actions/start-yarn' |
46 | --- actions/start-yarn 1970-01-01 00:00:00 +0000 |
47 | +++ actions/start-yarn 2015-06-26 22:25:03 +0000 |
48 | @@ -0,0 +1,4 @@ |
49 | +#!/bin/bash |
50 | +. /etc/environment |
51 | +cd ${HADOOP_HOME}/sbin |
52 | +su yarn -c "./start-yarn.sh" |
53 | |
54 | === added file 'actions/stop-yarn' |
55 | --- actions/stop-yarn 1970-01-01 00:00:00 +0000 |
56 | +++ actions/stop-yarn 2015-06-26 22:25:03 +0000 |
57 | @@ -0,0 +1,4 @@ |
58 | +#!/bin/bash |
59 | +. /etc/environment |
60 | +cd ${HADOOP_HOME}/sbin |
61 | +su yarn -c "./stop-yarn.sh" |
62 | |
63 | === modified file 'hooks/callbacks.py' |
64 | --- hooks/callbacks.py 2015-05-12 21:51:52 +0000 |
65 | +++ hooks/callbacks.py 2015-06-26 22:25:03 +0000 |
66 | @@ -15,3 +15,34 @@ |
67 | Add any additional tasks / setup here. If a callback is used by mutliple |
68 | charms, consider refactoring it up to the jujubigdata library. |
69 | """ |
70 | + |
71 | +from charmhelpers.core import hookenv |
72 | +from charmhelpers.core import unitdata |
73 | +from jujubigdata.relations import NameNode, NodeManager |
74 | + |
75 | + |
76 | +def update_blocked_status(): |
77 | + if unitdata.kv().get('charm.active', False): |
78 | + return |
79 | + if NameNode().connected_units(): |
80 | + hookenv.status_set('waiting', 'Waiting for HDFS master to provide NameNode'), |
81 | + else: |
82 | + hookenv.status_set('blocked', 'Waiting for relation to HDFS master'), |
83 | + |
84 | + |
85 | +def update_working_status(): |
86 | + if unitdata.kv().get('charm.active', False): |
87 | + hookenv.status_set('maintenance', 'Updating configuration') |
88 | + return |
89 | + hookenv.status_set('maintenance', 'Setting up Yarn master') |
90 | + |
91 | + |
92 | +def update_active_status(): |
93 | + nodemanager = NodeManager() |
94 | + if nodemanager.is_ready(): |
95 | + hookenv.status_set('active', 'Ready (%s NodeManagers)' % len(nodemanager.filtered_data())) |
96 | + unitdata.kv().set('charm.active', True) |
97 | + elif nodemanager.connected_units(): |
98 | + hookenv.status_set('waiting', 'Waiting for compute slaves to provide NodeManagers') |
99 | + else: |
100 | + hookenv.status_set('blocked', 'Waiting for relation to compute slaves') |
101 | |
102 | === modified file 'hooks/common.py' |
103 | --- hooks/common.py 2015-05-13 16:48:39 +0000 |
104 | +++ hooks/common.py 2015-06-26 22:25:03 +0000 |
105 | @@ -15,29 +15,39 @@ |
106 | """ |
107 | |
108 | import jujuresources |
109 | +from charmhelpers.core import hookenv |
110 | +from charmhelpers.core import unitdata |
111 | +from charmhelpers.core import charmframework |
112 | |
113 | |
114 | def bootstrap_resources(): |
115 | """ |
116 | Attempt to load and install resources defined in resources.yaml |
117 | """ |
118 | + if unitdata.kv().get('charm.bootstrapped', False): |
119 | + return True |
120 | + hookenv.status_set('maintenance', 'Installing base resources') |
121 | mirror_url = jujuresources.config_get('resources_mirror') |
122 | if not jujuresources.fetch(mirror_url=mirror_url): |
123 | - jujuresources.juju_log('Required resources unavailable; changing resources_mirror option is required', 'ERROR') |
124 | + missing = jujuresources.invalid() |
125 | + hookenv.status_set('blocked', 'Unable to fetch required resource%s: %s' % ( |
126 | + 's' if len(missing) > 1 else '', |
127 | + ', '.join(missing), |
128 | + )) |
129 | return False |
130 | - jujuresources.install(['pathlib', 'pyaml', 'six', 'charmhelpers', 'jujubigdata']) |
131 | + jujuresources.install(['pathlib', 'jujubigdata']) |
132 | + unitdata.kv().set('charm.bootstrapped', True) |
133 | return True |
134 | |
135 | |
136 | def manage(): |
137 | if not bootstrap_resources(): |
138 | - # defer until resources are available, since charmhelpers, and thus |
139 | - # the framework, are required (will require manual intervention) |
140 | + # defer until resources are available, since jujubigdata, and thus the |
141 | + # classes needed for the requires blocks, (will be) managed by jujuresources |
142 | return |
143 | |
144 | - from charmhelpers.core import charmframework |
145 | import jujubigdata |
146 | - import callbacks # noqa (ignore when linting) |
147 | + import callbacks |
148 | |
149 | # list of keys required to be in the dist.yaml |
150 | yarn_reqs = ['vendor', 'hadoop_version', 'packages', 'groups', |
151 | @@ -48,9 +58,10 @@ |
152 | yarn = jujubigdata.handlers.YARN(hadoop) |
153 | hdfs = jujubigdata.handlers.HDFS(hadoop) |
154 | port = dist_config.port('resourcemanager') |
155 | - hs_port = dist_config.port('jh_webapp_http') |
156 | + hs_port = dist_config.port('jobhistory') |
157 | nodemanagers = jujubigdata.relations.ResourceManagerMaster(spec=hadoop.spec, port=port, historyserver_port=hs_port) |
158 | clients = jujubigdata.relations.ResourceManager(spec=hadoop.spec, port=port, historyserver_port=hs_port) |
159 | + namenode = jujubigdata.relations.NameNode(spec=hadoop.client_spec) |
160 | manager = charmframework.Manager([ |
161 | { |
162 | 'name': 'hadoop-base', |
163 | @@ -59,6 +70,7 @@ |
164 | ], |
165 | 'callbacks': [ |
166 | hadoop.install, |
167 | + callbacks.update_blocked_status, |
168 | ], |
169 | }, |
170 | { |
171 | @@ -69,12 +81,19 @@ |
172 | ], |
173 | 'requires': [ |
174 | hadoop.is_installed, |
175 | - jujubigdata.relations.NameNode(spec=hadoop.client_spec), |
176 | + namenode, |
177 | jujubigdata.relations.NodeManager(optional=True), |
178 | ], |
179 | 'callbacks': [ |
180 | - nodemanagers.register_host_ips, |
181 | - jujubigdata.utils.update_etc_hosts_from_kv, |
182 | + # These callbacks will be executed once the Hadoop base packages |
183 | + # are installed and HDFS is available. New items can be added |
184 | + # to the end of this list and to hooks/callbacks.py to extend |
185 | + # the functionality of this charm. |
186 | + callbacks.update_working_status, |
187 | + nodemanagers.register_connected_hosts, |
188 | + clients.register_connected_hosts, |
189 | + namenode.register_provided_hosts, |
190 | + jujubigdata.utils.manage_etc_hosts, |
191 | hdfs.configure_client, |
192 | yarn.configure_resourcemanager, |
193 | yarn.configure_jobhistory, |
194 | @@ -82,6 +101,7 @@ |
195 | yarn.start_resourcemanager, |
196 | yarn.start_jobhistory, |
197 | charmframework.helpers.open_ports(dist_config.exposed_ports('yarn-master')), |
198 | + callbacks.update_active_status, |
199 | ], |
200 | 'cleanup': [ |
201 | charmframework.helpers.close_ports(dist_config.exposed_ports('yarn-master')), |
202 | |
203 | === modified file 'hooks/config-changed' |
204 | --- hooks/config-changed 2015-02-09 18:17:08 +0000 |
205 | +++ hooks/config-changed 2015-06-26 22:25:03 +0000 |
206 | @@ -11,5 +11,16 @@ |
207 | # See the License for the specific language governing permissions and |
208 | # limitations under the License. |
209 | |
210 | +""" |
211 | +All hooks in this charm are managed by the Charm Framework. |
212 | +The framework helps manage dependencies and preconditions to ensure that |
213 | +steps are only executed when they can be successful. As such, no additional |
214 | +code should be added to this hook; instead, please integrate new functionality |
215 | +into the 'callbacks' list in hooks/common.py. New callbacks can be placed |
216 | +in hooks/callbacks.py, if necessary. |
217 | + |
218 | +See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html |
219 | +for more information. |
220 | +""" |
221 | import common |
222 | common.manage() |
223 | |
224 | === modified file 'hooks/install' |
225 | --- hooks/install 2015-02-09 18:17:08 +0000 |
226 | +++ hooks/install 2015-06-26 22:25:03 +0000 |
227 | @@ -13,5 +13,16 @@ |
228 | import setup |
229 | setup.pre_install() |
230 | |
231 | +""" |
232 | +All hooks in this charm are managed by the Charm Framework. |
233 | +The framework helps manage dependencies and preconditions to ensure that |
234 | +steps are only executed when they can be successful. As such, no additional |
235 | +code should be added to this hook; instead, please integrate new functionality |
236 | +into the 'callbacks' list in hooks/common.py. New callbacks can be placed |
237 | +in hooks/callbacks.py, if necessary. |
238 | + |
239 | +See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html |
240 | +for more information. |
241 | +""" |
242 | import common |
243 | common.manage() |
244 | |
245 | === modified file 'hooks/namenode-relation-changed' |
246 | --- hooks/namenode-relation-changed 2015-05-12 21:51:52 +0000 |
247 | +++ hooks/namenode-relation-changed 2015-06-26 22:25:03 +0000 |
248 | @@ -11,5 +11,16 @@ |
249 | # See the License for the specific language governing permissions and |
250 | # limitations under the License. |
251 | |
252 | +""" |
253 | +All hooks in this charm are managed by the Charm Framework. |
254 | +The framework helps manage dependencies and preconditions to ensure that |
255 | +steps are only executed when they can be successful. As such, no additional |
256 | +code should be added to this hook; instead, please integrate new functionality |
257 | +into the 'callbacks' list in hooks/common.py. New callbacks can be placed |
258 | +in hooks/callbacks.py, if necessary. |
259 | + |
260 | +See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html |
261 | +for more information. |
262 | +""" |
263 | import common |
264 | common.manage() |
265 | |
266 | === modified file 'hooks/nodemanager-relation-changed' |
267 | --- hooks/nodemanager-relation-changed 2015-05-12 21:51:52 +0000 |
268 | +++ hooks/nodemanager-relation-changed 2015-06-26 22:25:03 +0000 |
269 | @@ -11,5 +11,16 @@ |
270 | # See the License for the specific language governing permissions and |
271 | # limitations under the License. |
272 | |
273 | +""" |
274 | +All hooks in this charm are managed by the Charm Framework. |
275 | +The framework helps manage dependencies and preconditions to ensure that |
276 | +steps are only executed when they can be successful. As such, no additional |
277 | +code should be added to this hook; instead, please integrate new functionality |
278 | +into the 'callbacks' list in hooks/common.py. New callbacks can be placed |
279 | +in hooks/callbacks.py, if necessary. |
280 | + |
281 | +See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html |
282 | +for more information. |
283 | +""" |
284 | import common |
285 | common.manage() |
286 | |
287 | === modified file 'hooks/resourcemanager-relation-changed' |
288 | --- hooks/resourcemanager-relation-changed 2015-05-19 16:28:14 +0000 |
289 | +++ hooks/resourcemanager-relation-changed 2015-06-26 22:25:03 +0000 |
290 | @@ -11,5 +11,16 @@ |
291 | # See the License for the specific language governing permissions and |
292 | # limitations under the License. |
293 | |
294 | +""" |
295 | +All hooks in this charm are managed by the Charm Framework. |
296 | +The framework helps manage dependencies and preconditions to ensure that |
297 | +steps are only executed when they can be successful. As such, no additional |
298 | +code should be added to this hook; instead, please integrate new functionality |
299 | +into the 'callbacks' list in hooks/common.py. New callbacks can be placed |
300 | +in hooks/callbacks.py, if necessary. |
301 | + |
302 | +See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html |
303 | +for more information. |
304 | +""" |
305 | import common |
306 | common.manage() |
307 | |
308 | === modified file 'hooks/setup.py' |
309 | --- hooks/setup.py 2015-03-03 21:31:05 +0000 |
310 | +++ hooks/setup.py 2015-06-26 22:25:03 +0000 |
311 | @@ -12,24 +12,22 @@ |
312 | import subprocess |
313 | from glob import glob |
314 | |
315 | + |
316 | def pre_install(): |
317 | """ |
318 | Do any setup required before the install hook. |
319 | """ |
320 | install_pip() |
321 | - install_jujuresources() |
322 | + install_bundled_resources() |
323 | |
324 | |
325 | def install_pip(): |
326 | subprocess.check_call(['apt-get', 'install', '-yq', 'python-pip', 'bzr']) |
327 | |
328 | |
329 | -def install_jujuresources(): |
330 | - """ |
331 | - Install the bundled jujuresources library, if not present. |
332 | - """ |
333 | - try: |
334 | - import jujuresources # noqa |
335 | - except ImportError: |
336 | - jr_archive = glob('resources/jujuresources-*.tar.gz')[0] |
337 | - subprocess.check_call(['pip', 'install', jr_archive]) |
338 | +def install_bundled_resources(): |
339 | + """ |
340 | + Install the bundled resources libraries. |
341 | + """ |
342 | + archives = glob('resources/python/*') |
343 | + subprocess.check_call(['pip', 'install'] + archives) |
344 | |
345 | === modified file 'hooks/start' |
346 | --- hooks/start 2015-02-09 18:17:08 +0000 |
347 | +++ hooks/start 2015-06-26 22:25:03 +0000 |
348 | @@ -11,5 +11,16 @@ |
349 | # See the License for the specific language governing permissions and |
350 | # limitations under the License. |
351 | |
352 | +""" |
353 | +All hooks in this charm are managed by the Charm Framework. |
354 | +The framework helps manage dependencies and preconditions to ensure that |
355 | +steps are only executed when they can be successful. As such, no additional |
356 | +code should be added to this hook; instead, please integrate new functionality |
357 | +into the 'callbacks' list in hooks/common.py. New callbacks can be placed |
358 | +in hooks/callbacks.py, if necessary. |
359 | + |
360 | +See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html |
361 | +for more information. |
362 | +""" |
363 | import common |
364 | common.manage() |
365 | |
366 | === modified file 'hooks/stop' |
367 | --- hooks/stop 2015-02-09 18:17:08 +0000 |
368 | +++ hooks/stop 2015-06-26 22:25:03 +0000 |
369 | @@ -11,5 +11,16 @@ |
370 | # See the License for the specific language governing permissions and |
371 | # limitations under the License. |
372 | |
373 | +""" |
374 | +All hooks in this charm are managed by the Charm Framework. |
375 | +The framework helps manage dependencies and preconditions to ensure that |
376 | +steps are only executed when they can be successful. As such, no additional |
377 | +code should be added to this hook; instead, please integrate new functionality |
378 | +into the 'callbacks' list in hooks/common.py. New callbacks can be placed |
379 | +in hooks/callbacks.py, if necessary. |
380 | + |
381 | +See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html |
382 | +for more information. |
383 | +""" |
384 | import common |
385 | common.manage() |
386 | |
387 | === modified file 'resources.yaml' |
388 | --- resources.yaml 2015-05-28 18:17:21 +0000 |
389 | +++ resources.yaml 2015-06-26 22:25:03 +0000 |
390 | @@ -3,23 +3,15 @@ |
391 | resources: |
392 | pathlib: |
393 | pypi: path.py>=7.0 |
394 | - pyaml: |
395 | - pypi: pyaml |
396 | - six: |
397 | - pypi: six |
398 | jujubigdata: |
399 | - pypi: jujubigdata>=1.2.14,<2.0.0 |
400 | - charmhelpers: |
401 | - pypi: http://bazaar.launchpad.net/~bigdata-dev/bigdata-data/trunk/download/kevin.monroe%40canonical.com-20150511173636-5rblzf5r2o1zcv2p/charmhelpers0.2.3.ta-20150417221203-zg62z8c220egc3ch-1/charmhelpers-0.2.3.tar.gz |
402 | - hash: 44340a6fd6f192bcc9d390c0d9c3901d4fc190166485b107047bc1c6ba102a2f |
403 | - hash_type: sha256 |
404 | + pypi: jujubigdata>=2.0.2,<3.0.0 |
405 | java-installer: |
406 | # This points to a script which manages installing Java. |
407 | # If replaced with an alternate implementation, it must output *only* two |
408 | # lines containing the JAVA_HOME path, and the Java version, respectively, |
409 | # on stdout. Upon error, it must exit with a non-zero exit code. |
410 | - url: http://bazaar.launchpad.net/~bigdata-dev/bigdata-data/trunk/download/cory.johns%40canonical.com-20150312205309-2ji1etk44gep01w1/javainstaller.sh-20150311213053-4vq7369jhlvc6qy8-1/java-installer.sh |
411 | - hash: 130984f1dc3bc624d4245234d0fca22f529d234d0eaa1241c5e9f701319bdea9 |
412 | + url: http://bazaar.launchpad.net/~bigdata-dev/bigdata-data/trunk/download/kevin.monroe%40canonical.com-20150625222410-qfck64q46ubx5i6p/javainstaller.sh-20150311213053-4vq7369jhlvc6qy8-1/java-installer.sh |
413 | + hash: 8fdff60270ea4be7bbef1e013e503057fe6efc2f4b5761edebc206a54f303023 |
414 | hash_type: sha256 |
415 | optional_resources: |
416 | hadoop-aarch64: |
417 | |
418 | === removed file 'resources/jujuresources-0.2.5.tar.gz' |
419 | Binary files resources/jujuresources-0.2.5.tar.gz 2015-03-03 19:58:27 +0000 and resources/jujuresources-0.2.5.tar.gz 1970-01-01 00:00:00 +0000 differ |
420 | === added directory 'resources/python' |
421 | === added file 'resources/python/PyYAML-3.11.tar.gz' |
422 | Binary files resources/python/PyYAML-3.11.tar.gz 1970-01-01 00:00:00 +0000 and resources/python/PyYAML-3.11.tar.gz 2015-06-26 22:25:03 +0000 differ |
423 | === added file 'resources/python/charmhelpers-0.3.1.tar.gz' |
424 | Binary files resources/python/charmhelpers-0.3.1.tar.gz 1970-01-01 00:00:00 +0000 and resources/python/charmhelpers-0.3.1.tar.gz 2015-06-26 22:25:03 +0000 differ |
425 | === added file 'resources/python/jujuresources-0.2.8.tar.gz' |
426 | Binary files resources/python/jujuresources-0.2.8.tar.gz 1970-01-01 00:00:00 +0000 and resources/python/jujuresources-0.2.8.tar.gz 2015-06-26 22:25:03 +0000 differ |
427 | === added file 'resources/python/pyaml-15.5.7.tar.gz' |
428 | Binary files resources/python/pyaml-15.5.7.tar.gz 1970-01-01 00:00:00 +0000 and resources/python/pyaml-15.5.7.tar.gz 2015-06-26 22:25:03 +0000 differ |
429 | === added file 'resources/python/six-1.9.0-py2.py3-none-any.whl' |
430 | Binary files resources/python/six-1.9.0-py2.py3-none-any.whl 1970-01-01 00:00:00 +0000 and resources/python/six-1.9.0-py2.py3-none-any.whl 2015-06-26 22:25:03 +0000 differ |
actions + status + bundled resources + /etc/hosts refactor + java fix + jobhistory fix = LGTM, +1.
Merged into to -dev and pushed to -charmers.