Merge lp:~bigdata-dev/charms/trusty/apache-hadoop-yarn-master/trunk into lp:charms/trusty/apache-hadoop-yarn-master

Proposed by Kevin W Monroe
Status: Merged
Merged at revision: 90
Proposed branch: lp:~bigdata-dev/charms/trusty/apache-hadoop-yarn-master/trunk
Merge into: lp:charms/trusty/apache-hadoop-yarn-master
Diff against target: 320 lines (+222/-10) (has conflicts)
9 files modified
README.md (+21/-0)
config.yaml (+10/-0)
hooks/callbacks.py (+42/-5)
hooks/common.py (+24/-3)
hooks/ganglia-relation-broken (+26/-0)
hooks/ganglia-relation-changed (+26/-0)
metadata.yaml (+2/-0)
templates/hadoop-metrics2.properties.j2 (+69/-0)
tests/01-basic-deployment.py (+2/-2)
Text conflict in hooks/callbacks.py
Text conflict in hooks/common.py
To merge this branch: bzr merge lp:~bigdata-dev/charms/trusty/apache-hadoop-yarn-master/trunk
Reviewer Review Type Date Requested Status
Kevin W Monroe Approve
Review via email: mp+271165@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Kevin W Monroe (kwmonroe) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README.md'
--- README.md 2015-08-24 23:16:05 +0000
+++ README.md 2015-09-15 17:35:17 +0000
@@ -27,6 +27,24 @@
27 hadoop jar my-job.jar27 hadoop jar my-job.jar
2828
2929
30## Monitoring
31
32This charm supports monitoring via Ganglia. To enable monitoring, you must
33do **both** of the following (the order does not matter):
34
35 * Add a relation to the [Ganglia charm][] via the `:master` relation
36 * Enable the `ganglia_metrics` config option
37
38For example:
39
40 juju add-relation yarn-master ganglia:master
41 juju set yarn-master ganglia_metrics=true
42
43Enabling monitoring will issue restart the ResourceManager and all NodeManager
44components on all of the related compute-slaves. Take care to ensure that there
45are no running jobs when enabling monitoring.
46
47
30## Deploying in Network-Restricted Environments48## Deploying in Network-Restricted Environments
3149
32The Apache Hadoop charms can be deployed in environments with limited network50The Apache Hadoop charms can be deployed in environments with limited network
@@ -75,3 +93,6 @@
75- [Apache Hadoop bug trackers](http://hadoop.apache.org/issue_tracking.html)93- [Apache Hadoop bug trackers](http://hadoop.apache.org/issue_tracking.html)
76- [Apache Hadoop mailing lists](http://hadoop.apache.org/mailing_lists.html)94- [Apache Hadoop mailing lists](http://hadoop.apache.org/mailing_lists.html)
77- [Apache Hadoop Juju Charm](http://jujucharms.com/?text=hadoop)95- [Apache Hadoop Juju Charm](http://jujucharms.com/?text=hadoop)
96
97
98[Ganglia charm]: http://jujucharms.com/ganglia/
7899
=== modified file 'config.yaml'
--- config.yaml 2015-04-03 16:49:17 +0000
+++ config.yaml 2015-09-15 17:35:17 +0000
@@ -4,3 +4,13 @@
4 default: ''4 default: ''
5 description: |5 description: |
6 URL from which to fetch resources (e.g., Hadoop binaries) instead of Launchpad.6 URL from which to fetch resources (e.g., Hadoop binaries) instead of Launchpad.
7 ganglia_metrics:
8 type: boolean
9 default: false
10 description: |
11 Enable metrics using Ganglia. Note that enabling this option will
12 have no effect if the service is not related to a ganglia service
13 via the ganglia:master relation. Enabling this option with the
14 relation will issue a restart to the ResourceManager and all
15 NodeManager components on all related compute-slaves.
16 See the README for more information.
717
=== modified file 'hooks/callbacks.py'
--- hooks/callbacks.py 2015-08-10 22:59:54 +0000
+++ hooks/callbacks.py 2015-09-15 17:35:17 +0000
@@ -18,7 +18,10 @@
1818
19from charmhelpers.core import hookenv19from charmhelpers.core import hookenv
20from charmhelpers.core import unitdata20from charmhelpers.core import unitdata
21from jujubigdata.relations import NameNode, NodeManager21from jujubigdata.relations import NameNode, NodeManager, Ganglia
22from charmhelpers.core.templating import render
23from functools import partial
24from subprocess import check_call
2225
2326
24def update_blocked_status():27def update_blocked_status():
@@ -46,7 +49,41 @@
46 hookenv.status_set('waiting', 'Waiting for compute slaves to provide NodeManagers')49 hookenv.status_set('waiting', 'Waiting for compute slaves to provide NodeManagers')
47 else:50 else:
48 hookenv.status_set('blocked', 'Waiting for relation to compute slaves')51 hookenv.status_set('blocked', 'Waiting for relation to compute slaves')
4952<<<<<<< TREE
5053
51def clear_active_flag():54
52 unitdata.kv().set('charm.active', False)55def clear_active_flag():
56 unitdata.kv().set('charm.active', False)
57=======
58
59
60def clear_active_flag():
61 unitdata.kv().set('charm.active', False)
62
63
64def conf_ganglia_metrics(purgeConf=False):
65 """
66 Send hadoop specific metrics to a ganglia server
67 """
68 config = hookenv.config()
69 ganglia_metrics = config['ganglia_metrics'] and not purgeConf
70 ganglia_metrics_changed = ganglia_metrics != unitdata.kv().get('ganglia_metrics', False)
71 unitdata.kv().set('ganglia_metrics', ganglia_metrics)
72 comment = '#' if not ganglia_metrics else ''
73 ganglia_host = 'UNSET_BY_JUJU' if not ganglia_metrics else Ganglia().host()
74 ganglia_sink_str = comment + '*.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31'
75 hookenv.log("Configuring ganglia sink in /etc/hadoop/conf/hadoop-metrics2.properties", level=None)
76 render(
77 source='hadoop-metrics2.properties.j2',
78 target='/etc/hadoop/conf/hadoop-metrics2.properties',
79 context={
80 'ganglia_host': ganglia_host,
81 'ganglia_sink_str': ganglia_sink_str,
82 },
83 ),
84 if ganglia_metrics_changed:
85 check_call(['actions/restart-yarn'])
86
87
88purge_ganglia_metrics = partial(conf_ganglia_metrics, purgeConf=True)
89>>>>>>> MERGE-SOURCE
5390
=== modified file 'hooks/common.py' (properties changed: +x to -x)
--- hooks/common.py 2015-08-10 22:59:54 +0000
+++ hooks/common.py 2015-09-15 17:35:17 +0000
@@ -113,9 +113,30 @@
113 charmframework.helpers.close_ports(dist_config.exposed_ports('yarn-master')),113 charmframework.helpers.close_ports(dist_config.exposed_ports('yarn-master')),
114 yarn.stop_resourcemanager,114 yarn.stop_resourcemanager,
115 yarn.stop_jobhistory,115 yarn.stop_jobhistory,
116 callbacks.update_blocked_status,116<<<<<<< TREE
117 ],117 callbacks.update_blocked_status,
118 },118 ],
119 },
120=======
121 callbacks.update_blocked_status,
122 ],
123 },
124 {
125 'name': 'ganglia',
126 'requires': [
127 hadoop.is_installed,
128 jujubigdata.relations.Ganglia,
129 ],
130 'callbacks': [
131 callbacks.conf_ganglia_metrics,
132 ],
133 'cleanup': [
134 callbacks.purge_ganglia_metrics,
135 ],
136
137 },
138
139>>>>>>> MERGE-SOURCE
119 ])140 ])
120 manager.manage()141 manager.manage()
121142
122143
=== added file 'hooks/ganglia-relation-broken'
--- hooks/ganglia-relation-broken 1970-01-01 00:00:00 +0000
+++ hooks/ganglia-relation-broken 2015-09-15 17:35:17 +0000
@@ -0,0 +1,26 @@
1#!/usr/bin/env python
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14"""
15All hooks in this charm are managed by the Charm Framework.
16The framework helps manage dependencies and preconditions to ensure that
17steps are only executed when they can be successful. As such, no additional
18code should be added to this hook; instead, please integrate new functionality
19into the 'callbacks' list in hooks/common.py. New callbacks can be placed
20in hooks/callbacks.py, if necessary.
21
22See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html
23for more information.
24"""
25import common
26common.manage()
027
=== added file 'hooks/ganglia-relation-changed'
--- hooks/ganglia-relation-changed 1970-01-01 00:00:00 +0000
+++ hooks/ganglia-relation-changed 2015-09-15 17:35:17 +0000
@@ -0,0 +1,26 @@
1#!/usr/bin/env python
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14"""
15All hooks in this charm are managed by the Charm Framework.
16The framework helps manage dependencies and preconditions to ensure that
17steps are only executed when they can be successful. As such, no additional
18code should be added to this hook; instead, please integrate new functionality
19into the 'callbacks' list in hooks/common.py. New callbacks can be placed
20in hooks/callbacks.py, if necessary.
21
22See http://big-data-charm-helpers.readthedocs.org/en/latest/examples/framework.html
23for more information.
24"""
25import common
26common.manage()
027
=== modified file 'metadata.yaml'
--- metadata.yaml 2015-04-23 20:48:28 +0000
+++ metadata.yaml 2015-09-15 17:35:17 +0000
@@ -10,6 +10,8 @@
10provides:10provides:
11 resourcemanager:11 resourcemanager:
12 interface: mapred12 interface: mapred
13 ganglia:
14 interface: monitor
13requires:15requires:
14 namenode:16 namenode:
15 interface: dfs17 interface: dfs
1618
=== added file 'resources/python/jujuresources-0.2.11.tar.gz'
17Binary files resources/python/jujuresources-0.2.11.tar.gz 1970-01-01 00:00:00 +0000 and resources/python/jujuresources-0.2.11.tar.gz 2015-09-15 17:35:17 +0000 differ19Binary files resources/python/jujuresources-0.2.11.tar.gz 1970-01-01 00:00:00 +0000 and resources/python/jujuresources-0.2.11.tar.gz 2015-09-15 17:35:17 +0000 differ
=== added directory 'templates'
=== added file 'templates/hadoop-metrics2.properties.j2'
--- templates/hadoop-metrics2.properties.j2 1970-01-01 00:00:00 +0000
+++ templates/hadoop-metrics2.properties.j2 2015-09-15 17:35:17 +0000
@@ -0,0 +1,69 @@
1#
2# Licensed to the Apache Software Foundation (ASF) under one or more
3# contributor license agreements. See the NOTICE file distributed with
4# this work for additional information regarding copyright ownership.
5# The ASF licenses this file to You under the Apache License, Version 2.0
6# (the "License"); you may not use this file except in compliance with
7# the License. You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18# syntax: [prefix].[source|sink].[instance].[options]
19# See javadoc of package-info.java for org.apache.hadoop.metrics2 for details
20
21*.sink.file.class=org.apache.hadoop.metrics2.sink.FileSink
22# default sampling period, in seconds
23*.period=10
24
25# Defining sink for Ganglia 3.1
26{{ ganglia_sink_str }}
27
28# Default polling period for GangliaSink
29*.sink.ganglia.period=10
30
31# default for supportsparse is false
32*.sink.ganglia.supportsparse=true
33
34# Directing output to ganglia servers
35
36*.sink.ganglia.slope=jvm.metrics.gcCount=zero,jvm.metrics.memHeapUsedM=both
37*.sink.ganglia.dmax=jvm.metrics.threadsBlocked=70,jvm.metrics.memHeapUsedM=40
38
39namenode.sink.ganglia.servers={{ ganglia_host }}:8649
40datanode.sink.ganglia.servers={{ ganglia_host }}:8649
41jobtracker.sink.ganglia.servers={{ ganglia_host }}:8649
42tasktracker.sink.ganglia.servers={{ ganglia_host }}:8649
43maptask.sink.ganglia.servers={{ ganglia_host }}:8649
44reducetask.sink.ganglia.servers={{ ganglia_host }}:8649
45resourcemanager.sink.ganglia.servers={{ ganglia_host }}:8649
46nodemanager.sink.ganglia.servers={{ ganglia_host }}:8649
47historyserver.sink.ganglia.servers={{ ganglia_host }}:8649
48journalnode.sink.ganglia.servers={{ ganglia_host }}:8649
49resourcemanager.sink.ganglia.tagsForPrefix.yarn=Queue
50
51# The namen de-metrics. ut will contain metrics from all context
52#namenode.sink.file.filename=namenode-metrics.out
53# Specifying a special sampling period for namenode:
54#namenode.sink.*.period=8
55
56#datanode.sink.file.filename=datanode-metrics.out
57
58# the following example split metrics of different
59# context to different sinks (in this case files)
60#jobtracker.sink.file_jvm.context=jvm
61#jobtracker.sink.file_jvm.filename=jobtracker-jvm-metrics.out
62#jobtracker.sink.file_mapred.context=mapred
63#jobtracker.sink.file_mapred.filename=jobtracker-mapred-metrics.out
64
65#tasktracker.sink.file.filename=tasktracker-metrics.out
66
67#maptask.sink.file.filename=maptask-metrics.out
68
69#reducetask.sink.file.filename=reducetask-metrics.out
070
=== modified file 'tests/01-basic-deployment.py'
--- tests/01-basic-deployment.py 2015-03-04 01:00:27 +0000
+++ tests/01-basic-deployment.py 2015-09-15 17:35:17 +0000
@@ -16,8 +16,8 @@
16 def setUpClass(cls):16 def setUpClass(cls):
17 cls.d = amulet.Deployment(series='trusty')17 cls.d = amulet.Deployment(series='trusty')
18 cls.d.add('apache-hadoop-yarn-master')18 cls.d.add('apache-hadoop-yarn-master')
19 cls.d.setup(timeout=9000)19 cls.d.setup(timeout=900)
20 cls.d.sentry.wait()20 cls.d.sentry.wait(timeout=1800)
21 cls.unit = cls.d.sentry.unit['apache-hadoop-yarn-master/0']21 cls.unit = cls.d.sentry.unit['apache-hadoop-yarn-master/0']
2222
23 def test_deploy(self):23 def test_deploy(self):

Subscribers

People subscribed via source and target branches