From 1695d4a138673e37653194ce8da2ddfa898eab5c Mon Sep 17 00:00:00 2001 From: YevhenLukomskyi Date: Thu, 3 Jan 2019 22:48:35 +0200 Subject: [PATCH 1/9] set package long description --- MANIFEST.in | 1 + setup.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index b16f3092..9e8199cd 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ +include README.md exclude .* MANIFEST.in global-exclude __pycache__ global-exclude *.py[co] diff --git a/setup.py b/setup.py index 8b9c696b..907d6612 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,15 @@ #!/usr/bin/env python +import os from glob import glob from distutils.core import setup +def read(fname): + with open(os.path.join(os.path.dirname(__file__), fname)) as f: + return f.read() + + setup( name='whisper', version='1.1.5', @@ -12,6 +18,8 @@ author_email='chrismd@gmail.com', license='Apache Software License 2.0', description='Fixed size round-robin style database', + long_description=read('README.md'), + long_description_content_type='text/markdown', py_modules=['whisper'], scripts=glob('bin/*') + glob('contrib/*'), install_requires=['six'], From 326b492ca5b4031c553dbb7157df82a29ef159a5 Mon Sep 17 00:00:00 2001 From: Piotr Date: Mon, 7 Jan 2019 21:37:15 +0100 Subject: [PATCH 2/9] Switch to setuptools removes warnings UserWarning: Unknown distribution option: 'install_requires' UserWarning: Unknown distribution option: 'long_description_content_type' setuptools seems to be the recommended way now. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 907d6612..8a1f6241 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import os from glob import glob -from distutils.core import setup +from setuptools import setup def read(fname): @@ -34,4 +34,5 @@ def read(fname): 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', ], + zip_safe=False ) From 60ff9fbd1dcd82335dfb69f3d269b78ae12605c5 Mon Sep 17 00:00:00 2001 From: Nate Tade Date: Thu, 10 Jan 2019 10:38:33 -0800 Subject: [PATCH 3/9] adding appropriate 'type' to sleep variable --- contrib/update-storage-times.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/update-storage-times.py b/contrib/update-storage-times.py index 5ae970e2..4f836aee 100755 --- a/contrib/update-storage-times.py +++ b/contrib/update-storage-times.py @@ -175,7 +175,7 @@ def cli_opts(): parser.add_argument('--bindir', action='store', dest='bindir', help="The root path to whisper-resize.py and whisper-info.py", default='/opt/graphite/bin') - parser.add_argument('--sleep', action='store', dest='sleep', + parser.add_argument('--sleep', action='store', type=int, dest='sleep', help="Sleep this amount of time in seconds between metric comparisons", default=0.3) return parser.parse_args() From 4a1001f0cae6dc5a5c03fed0975dc26a6071a6bc Mon Sep 17 00:00:00 2001 From: Nate Tade Date: Thu, 10 Jan 2019 10:40:53 -0800 Subject: [PATCH 4/9] adding appropriate 'type' to sleep variable --- contrib/update-storage-times.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/update-storage-times.py b/contrib/update-storage-times.py index 4f836aee..bc37c77c 100755 --- a/contrib/update-storage-times.py +++ b/contrib/update-storage-times.py @@ -175,7 +175,7 @@ def cli_opts(): parser.add_argument('--bindir', action='store', dest='bindir', help="The root path to whisper-resize.py and whisper-info.py", default='/opt/graphite/bin') - parser.add_argument('--sleep', action='store', type=int, dest='sleep', + parser.add_argument('--sleep', action='store', type=float, dest='sleep', help="Sleep this amount of time in seconds between metric comparisons", default=0.3) return parser.parse_args() From e4c3f79efca986f2ea05f67cfbe248bd43aee334 Mon Sep 17 00:00:00 2001 From: Piotr Date: Sun, 12 May 2019 14:56:24 +0200 Subject: [PATCH 5/9] Add testing for py38-dev and remove py34 --- .travis.yml | 13 ++++++------- setup.py | 1 - tox.ini | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78b1d235..78f386f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: python +dist: xenial sudo: false python: 2.7 @@ -9,9 +10,6 @@ matrix: - python: 2.7 env: - TOXENV=py27 - - python: 3.4 - env: - - TOXENV=py34 - python: 3.5 env: - TOXENV=py35 @@ -19,15 +17,16 @@ matrix: env: - TOXENV=py36 - python: 3.7 - dist: xenial - sudo: true env: - TOXENV=py37 + - python: "3.8-dev" + env: + - TOXENV=py38 - python: 3.7 - dist: xenial - sudo: true env: - TOXENV=lint + allow_failures: + - python: "3.8-dev" install: - pip install tox diff --git a/setup.py b/setup.py index 8a1f6241..8b8c69ee 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,6 @@ def read(fname): 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', diff --git a/tox.ini b/tox.ini index 7eee05a2..86475539 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] envlist = py27, - py34, py35, py36, py37, + py38, pypy, pypy3, lint, From 986d7da1010d788bdcddeb9a2d1d4d98b7a7e813 Mon Sep 17 00:00:00 2001 From: Piotr Date: Sun, 12 May 2019 15:03:12 +0200 Subject: [PATCH 6/9] whisper-fill: fix indentation --- .gitignore | 1 + bin/whisper-fill.py | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 4acbbda6..582b9a67 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ ve .idea *.iml *.swp +whisper.egg-info/ diff --git a/bin/whisper-fill.py b/bin/whisper-fill.py index aac9ef3d..84eccb68 100755 --- a/bin/whisper-fill.py +++ b/bin/whisper-fill.py @@ -122,27 +122,27 @@ def fill_archives(src, dst, startFrom): def main(): - option_parser = optparse.OptionParser( - usage='%prog [--lock] src dst', - description='copies data from src in dst, if missing') - option_parser.add_option( - '--lock', help='Lock whisper files', - default=False, action='store_true') - (options, args) = option_parser.parse_args() + option_parser = optparse.OptionParser( + usage='%prog [--lock] src dst', + description='copies data from src in dst, if missing') + option_parser.add_option( + '--lock', help='Lock whisper files', + default=False, action='store_true') + (options, args) = option_parser.parse_args() - if len(args) != 2: - option_parser.print_help() - sys.exit(1) + if len(args) != 2: + option_parser.print_help() + sys.exit(1) - if options.lock is True and whisper.CAN_LOCK: - whisper.LOCK = True + if options.lock is True and whisper.CAN_LOCK: + whisper.LOCK = True - src = args[0] - dst = args[1] - startFrom = time.time() + src = args[0] + dst = args[1] + startFrom = time.time() - fill_archives(src, dst, startFrom) + fill_archives(src, dst, startFrom) if __name__ == "__main__": - main() + main() From bc55cd33334d6c86d0c853aece4ec2cc711882cd Mon Sep 17 00:00:00 2001 From: Ryan Rawdon Date: Wed, 12 Jun 2019 15:25:13 -0400 Subject: [PATCH 7/9] Altering rrd2whisper.py to use listcomp instead of filter() for py3 compatibility with len(), to fix #278 --- bin/rrd2whisper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/rrd2whisper.py b/bin/rrd2whisper.py index 0fde5302..1c5ea7bb 100755 --- a/bin/rrd2whisper.py +++ b/bin/rrd2whisper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/home/rrawdon/git/whisper-env/bin/python3 import errno import os @@ -157,7 +157,7 @@ values = [row[column_index] for row in rows] timestamps = list(range(*time_info)) datapoints = zip(timestamps, values) - datapoints = filter(lambda p: p[1] is not None, datapoints) + datapoints = [datapoint for datapoint in datapoints if datapoint[1] is not None] print(' migrating %d datapoints from archive %d' % (len(datapoints), archiveNumber)) archiveNumber -= 1 whisper.update_many(path, datapoints) From 300bef15ecf7db62ebc2c932dc877432ab0447f1 Mon Sep 17 00:00:00 2001 From: Piotr Popieluch Date: Wed, 26 Jun 2019 11:26:41 +0200 Subject: [PATCH 8/9] Update rrd2whisper.py --- bin/rrd2whisper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/rrd2whisper.py b/bin/rrd2whisper.py index 1c5ea7bb..4abe7247 100755 --- a/bin/rrd2whisper.py +++ b/bin/rrd2whisper.py @@ -1,4 +1,4 @@ -#!/home/rrawdon/git/whisper-env/bin/python3 +#!/usr/bin/env python import errno import os From 60593a88d4c628d0678c35ef8eeacf1923524483 Mon Sep 17 00:00:00 2001 From: Glandos Date: Tue, 6 Aug 2019 20:48:05 +0200 Subject: [PATCH 9/9] Dump as raw values It could be useful to perform some unusual transformations and pipe back to `whisper-update` --- bin/whisper-dump.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/whisper-dump.py b/bin/whisper-dump.py index 49e3b155..caadcc10 100755 --- a/bin/whisper-dump.py +++ b/bin/whisper-dump.py @@ -26,6 +26,9 @@ option_parser.add_option( '-t', '--time-format', action='store', type='string', dest='time_format', help='Time format to use with --pretty; see time.strftime()') +option_parser.add_option( + '-r', '--raw', default=False, action='store_true', + help='Dump value only in the same format for whisper-update (UTC timestamps)') (options, args) = option_parser.parse_args() if len(args) != 1: @@ -101,7 +104,8 @@ def dump_archive_headers(archives): def dump_archives(archives, options): for i, archive in enumerate(archives): - print('Archive %d data:' % i) + if not options.raw: + print('Archive %d data:' % i) offset = archive['offset'] for point in xrange(archive['points']): (timestamp, value) = struct.unpack( @@ -116,7 +120,10 @@ def dump_archives(archives, options): timestr = time.ctime(timestamp) else: timestr = str(timestamp) - print('%d: %s, %10.35g' % (point, timestr, value)) + if options.raw: + print('%s:%.35g' % (timestamp, value)) + else: + print('%d: %s, %10.35g' % (point, timestr, value)) offset += whisper.pointSize print @@ -126,5 +133,6 @@ def dump_archives(archives, options): map = mmap_file(path) header = read_header(map) -dump_header(header) +if not options.raw: + dump_header(header) dump_archives(header['archives'], options)