Merge ~xavpaice/charm-mongodb:bug/1526990 into charm-mongodb:master

Proposed by Xav Paice
Status: Merged
Approved by: Paul Goins
Approved revision: 99ab1c0175c2516ea6d7ee46e64ef4e6d3daf10f
Merged at revision: 1ef9f20cfcdec9a97e013eff3897a85307ba3f0f
Proposed branch: ~xavpaice/charm-mongodb:bug/1526990
Merge into: charm-mongodb:master
Diff against target: 380 lines (+7/-268)
6 files modified
Makefile (+0/-4)
README.md (+0/-39)
actions.yaml (+0/-49)
dev/null (+0/-132)
hooks/hooks.py (+7/-41)
metadata.yaml (+0/-3)
Reviewer Review Type Date Requested Status
Paul Goins Approve
Joe Guo (community) Approve
Review via email: mp+387639@code.launchpad.net

Commit message

Remove Trusty support, remove perf

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Joe Guo (guoqiao) wrote :

LGTM, Approved.

review: Approve
Revision history for this message
Paul Goins (vultaire) wrote :

LGTM

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 1ef9f20cfcdec9a97e013eff3897a85307ba3f0f

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 2fdc717..fde3fc8 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -40,9 +40,5 @@ sync:
6 @curl -o bin/charm_helpers_sync.py https://raw.githubusercontent.com/juju/charm-helpers/master/tools/charm_helpers_sync/charm_helpers_sync.py
7 @$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-sync.yaml
8
9-# publish: lint unit
10-# bzr push lp:charms/mongodb
11-# bzr push lp:charms/trusty/mongodb
12-
13 # The targets below don't depend on a file
14 .PHONY: lint test unittest functional publish sync
15diff --git a/README.md b/README.md
16index 3b3560c..1b8e78e 100644
17--- a/README.md
18+++ b/README.md
19@@ -236,45 +236,6 @@ disk space.
20
21 To fetch the backups scp the files down from the path in the config.
22
23-### Benchmarking
24-
25-Mongo units can be benchmarked via the `perf` juju action, available beginning with juju 1.23.
26-
27- $ juju action defined mongodb
28- perf: The standard mongoperf benchmark.
29- $ juju action do mongodb/0 perf
30- Action queued with id: 23532149-15c2-47f0-8d97-115fb7dfa1cd
31- $ juju action fetch --wait 0 23532149-15c2-47f0-8d97-115fb7dfa1cd
32- results:
33- meta:
34- composite:
35- direction: desc
36- units: ops/sec
37- value: "7736507.70391"
38- start: 2015-05-07T16:36:04Z
39- stop: 2015-05-07T16:39:05Z
40- results:
41- average:
42- units: ops/sec
43- value: "7736507.70391"
44- iterations:
45- units: iterations
46- value: "179"
47- max:
48- units: ops/sec
49- value: "10282496"
50- min:
51- units: ops/sec
52- value: "3874546"
53- total:
54- units: ops
55- value: "1384834879"
56- status: completed
57- timing:
58- completed: 2015-05-07 16:39:06 +0000 UTC
59- enqueued: 2015-05-07 16:36:01 +0000 UTC
60- started: 2015-05-07 16:36:04 +0000 UTC
61-
62 ## Known Limitations and Issues
63
64 - If your master/slave/replicaset deployment is not updating correctly, check the log files at `/var/log/mongodb/mongodb.log` to see if there is an obvious reason ( port not open etc.).
65diff --git a/actions.yaml b/actions.yaml
66index 166cb45..3d53dd1 100644
67--- a/actions.yaml
68+++ b/actions.yaml
69@@ -1,52 +1,3 @@
70-perf:
71- description: The standard mongoperf benchmark.
72- params:
73- runtime:
74- description: The time, in seconds, to run mongoperf.
75- type: integer
76- default: 180
77- nthreads:
78- description: |
79- Defines the number of threads mongoperf will use in the test. To saturate your system’s storage system you will need multiple threads. Consider setting nThreads to 16.
80- type: integer
81- default: 1
82- fileSizeMB:
83- description: Test file size, in megabytes.
84- type: integer
85- default: 1
86- sleepMicros:
87- description: |
88- mongoperf will pause for the number of specified sleepMicros divided by the nThreads between each operation.
89- type: integer
90- default: 0
91- mmf:
92- description: |
93- Set mmf to true to use memory mapped files for the tests.
94- type: boolean
95- default: False
96- r:
97- description: |
98- Set r to true to perform reads as part of the tests.
99- type: boolean
100- default: False
101- w:
102- description: |
103- Set w to true to perform writes as part of the tests.
104- type: boolean
105- default: False
106- recSizeKB:
107- description: The size of each write operation, in kilobytes.
108- type: integer
109- default: 4
110- syncDelay:
111- description: |
112- Seconds between disk flushes. mongoperf.syncDelay is similar to --syncdelay for mongod.
113-
114- The syncDelay controls how frequently mongoperf performs an asynchronous disk flush of the memory mapped file used for testing. By default, mongod performs this operation every 60 seconds. Use syncDelay to test basic system performance of this type of operation.
115-
116- Only use syncDelay in conjunction with mmf set to true.
117- type: integer
118- default: 0
119 dump:
120 description: Runs the mongodump command
121 params:
122diff --git a/actions/perf b/actions/perf
123deleted file mode 100755
124index 444987a..0000000
125--- a/actions/perf
126+++ /dev/null
127@@ -1,132 +0,0 @@
128-#!/usr/bin/env python3
129-import signal
130-import subprocess
131-import os
132-import json
133-import re
134-from tempfile import NamedTemporaryFile
135-
136-try:
137- from distutils.spawn import find_executable
138-except ImportError:
139- subprocess.check_call(['apt-get', 'install', '-y', 'python3-distutils'])
140- from distutils.spawn import find_executable
141-
142-try:
143- from charms.benchmark import Benchmark
144-except ImportError:
145- subprocess.check_call(['apt-get', 'install', '-y', 'python3-pip'])
146- subprocess.check_call(['pip3', 'install', '-U', 'charms.benchmark'])
147- from charms.benchmark import Benchmark
148-
149-
150-def handler(signum, frame):
151- raise IOError('Timeout')
152-
153-
154-def action_set(key, val):
155- action_cmd = ['action-set']
156- if isinstance(val, dict):
157- for k, v in val.items():
158- action_set('%s.%s' % (key, k), v)
159- return
160-
161- action_cmd.append('%s=%s' % (key, val))
162- subprocess.check_call(action_cmd)
163-
164-
165-def action_get(key):
166- if find_executable('action-get'):
167- return subprocess.check_output(['action-get', key]).strip()
168- return None
169-
170-
171-def main():
172-
173- Benchmark.start()
174-
175- """
176- mongoperf runs until interupted so we have to use a
177- signal handler to stop it and gather the results
178- """
179- signal.signal(signal.SIGALRM, handler)
180- runtime = int(action_get('runtime') or 180)
181- signal.alarm(runtime)
182-
183- js = {}
184- js['nThreads'] = int(action_get('nthreads'))
185- js['fileSizeMB'] = int(action_get('fileSizeMB'))
186- js['sleepMicros'] = int(action_get('sleepMicros'))
187- js['mmf'] = action_get('mmf').decode()
188- js['r'] = action_get('r').decode()
189- js['w'] = action_get('w').decode()
190- js['recSizeKB'] = int(action_get('recSizeKB'))
191- js['syncDelay'] = int(action_get('syncDelay'))
192-
193- config = NamedTemporaryFile(delete=False)
194- config.write(json.dumps(js).encode())
195- config.close()
196- config = open(config.name, 'r')
197-
198- output = NamedTemporaryFile(delete=False)
199-
200- p = None
201- try:
202- p = subprocess.Popen(
203- 'mongoperf',
204- stdin=config,
205- stdout=output,
206- )
207- os.waitpid(p.pid, 0)
208- except subprocess.CalledProcessError as e:
209- rc = e.returncode
210- print("Exit with error code %d" % rc)
211- except IOError:
212- signal.alarm(0)
213- os.kill(p.pid, signal.SIGKILL)
214- finally:
215- os.unlink(config.name)
216-
217- output.close()
218- output = open(output.name, 'r')
219- scores = []
220- regex = re.compile(r'(\d+)\sops\/sec')
221- for line in output:
222- m = regex.match(line)
223- if m:
224- scores.append(int(m.group(1)))
225-
226- action_set(
227- "results.total",
228- {'value': sum(scores), 'units': 'ops'}
229- )
230-
231- action_set(
232- "results.iterations",
233- {'value': len(scores), 'units': 'iterations'}
234- )
235-
236- action_set(
237- "results.average",
238- {'value': sum(scores) / len(scores), 'units': 'ops/sec'}
239- )
240- action_set(
241- "results.max",
242- {'value': max(scores), 'units': 'ops/sec'}
243- )
244- action_set(
245- "results.min",
246- {'value': min(scores), 'units': 'ops/sec'}
247- )
248-
249- Benchmark.set_composite_score(
250- sum(scores) / len(scores),
251- 'ops/sec',
252- 'desc'
253- )
254-
255- Benchmark.finish()
256-
257-
258-if __name__ == "__main__":
259- main()
260diff --git a/hooks/hooks.py b/hooks/hooks.py
261index fab26b9..275a0ba 100755
262--- a/hooks/hooks.py
263+++ b/hooks/hooks.py
264@@ -19,19 +19,19 @@ import sys
265 import time
266
267 try:
268- import distro # flake8: noqa
269+ import distro
270 except ImportError:
271 pip.main(['install', "distro"])
272- import distro # flake8: noqa
273+ import distro
274
275 try:
276- import yaml # flake8: noqa
277+ import yaml
278 except ImportError:
279 if sys.version_info.major == 2:
280 subprocess.check_call(['apt-get', 'install', '-y', 'python-yaml'])
281 else:
282 subprocess.check_call(['apt-get', 'install', '-y', 'python3-yaml'])
283- import yaml # flake8: noqa
284+ import yaml
285
286 from os import chmod
287 from os import remove
288@@ -275,7 +275,7 @@ class TimeoutException(Exception):
289 ###############################################################################
290 # Charm support functions
291 ###############################################################################
292-def mongodb_conf(config_data=None): # noqa: C901 is too complex (28)
293+def mongodb_conf(config_data=None): # noqa: C901
294 if config_data is None:
295 return(None)
296 config = []
297@@ -950,19 +950,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
298 """ % (cron_runtime, script_filename))
299
300
301-# We can remove this quirk when charm no longer supports trusty
302-def arm64_trusty_quirk():
303- arch = subprocess.check_output(['dpkg', '--print-architecture']).decode("utf8").strip()
304- if arch != 'arm64':
305- return
306- if lsb_release()['DISTRIB_CODENAME'] != 'trusty':
307- return
308- ppa = 'ppa:mongodb-arm64/ppa'
309- juju_log("*** Detected trusty/arm64. Archive version contains incomplete "
310- "mongodb port, enabling installs from %s ***" % (ppa))
311- add_source(ppa)
312-
313-
314 ###############################################################################
315 # Hook functions
316 ###############################################################################
317@@ -974,16 +961,12 @@ def install_hook():
318 juju_log("Installing mongodb")
319 add_source(config('source'), config('key'))
320
321- # Allow users to bypass arm64/trusty workaround by adding their own source
322- if config('source') == 'None':
323- arm64_trusty_quirk()
324-
325 apt_update(fatal=True)
326 apt_install(packages=INSTALL_PACKAGES, fatal=True)
327
328
329-@hooks.hook('config-changed')
330-def config_changed(): # noqa: C901 is too complex (17)
331+@hooks.hook('config-changed') # noqa: C901
332+def config_changed():
333 juju_log("Entering config_changed")
334 status_set('maintenance', 'Configuring unit')
335 config_data = config()
336@@ -1131,23 +1114,6 @@ def stop_hook():
337 return(retVal)
338
339
340-@hooks.hook('benchmark-relation-joined')
341-@hooks.hook('benchmark-relation-changed')
342-def benchmark_relation_joined():
343- juju_log('benchmark-relation-joined')
344- try:
345- from charms.benchmark import Benchmark
346- except ImportError:
347- apt_install('python3-pip', fatal=True)
348- import subprocess
349- subprocess.check_call(['pip3', 'install', '-U', 'charms.benchmark'])
350- from charms.benchmark import Benchmark
351-
352- # Send a list of benchmark-enabled actions for display in the benchmark-gui
353- benchmarks = ['perf']
354- Benchmark(benchmarks)
355-
356-
357 @hooks.hook('database-relation-joined')
358 def database_relation_joined():
359 juju_log("database_relation_joined")
360diff --git a/metadata.yaml b/metadata.yaml
361index 7992cec..4604c93 100644
362--- a/metadata.yaml
363+++ b/metadata.yaml
364@@ -21,7 +21,6 @@ series:
365 - focal
366 - bionic
367 - xenial
368- - trusty
369 provides:
370 nrpe-external-master:
371 interface: nrpe-external-master
372@@ -34,8 +33,6 @@ provides:
373 interface: block-storage
374 scope: container
375 optional: true
376- benchmark:
377- interface: benchmark
378 requires:
379 mongos-cfg:
380 interface: shard

Subscribers

People subscribed via source and target branches

to all changes: