From 03be4251029281228f92d355bdb146be3d9ae048 Mon Sep 17 00:00:00 2001 From: agopi Date: Thu, 8 Nov 2018 14:30:44 -0500 Subject: [PATCH] Add numpy to extras Move numpy out of requirements into extras, as it's not required for running browbeat, but only used for insights like compare results. So to install with insights, pip install .[insights], to perform the CLI operations such as compare. Added a tox test to ensure no dep conflict arises. Change-Id: Id8aafcd479003ae79ab8c2d0f1fa378ea38d60d2 Closes-Bug: #1799690 --- browbeat/elastic.py | 4 +++- doc/source/usage.rst | 10 ++++++++++ requirements.txt | 1 - setup.cfg | 4 ++++ tox.ini | 9 ++++++++- 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/browbeat/elastic.py b/browbeat/elastic.py index a9daa5b31..ae9866f77 100644 --- a/browbeat/elastic.py +++ b/browbeat/elastic.py @@ -14,7 +14,6 @@ from collections import deque import datetime import json import logging -import numpy import os import re import sys @@ -181,6 +180,7 @@ class Elastic(object): """ def summarize_results(self, data, combined): + import numpy summary = {} if combined: if len(data) > 1: @@ -243,6 +243,7 @@ class Elastic(object): """ def compare_rally_results(self, data, uuids, combined, metadata=None): + import numpy missing = [] if len(data) < 2: self.logger.error("Not enough data to compare") @@ -350,6 +351,7 @@ class Elastic(object): """ def get_result_data(self, index, browbeat_uuid): + import numpy results = [] data = [] metadata = {} diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 0a814a4fa..e73dc07f7 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -364,6 +364,16 @@ Compare performance of two different runs Using the CLI the user can determine, run to run performance differences. This is a good tool for spot checking performance of an OpenStack release. +You'll need to install extra dependencies for browbeat insights, which will +provide additional modules needed for providing insights. + +To install : + +:: + + $ source browbeat/.browbeat-venv/bin/activate + $ pip install .[insights] + To use : :: diff --git a/requirements.txt b/requirements.txt index 3ab40f46a..a4686e9c2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ # to avoid dependency conflicts, try to use ranges, eventually banning a # buggy minor version (!=) or capping (<) once you have proof it breaks. ansible>=2.4.1 -numpy elasticsearch grafyaml>=0.0.7 openstacksdk diff --git a/setup.cfg b/setup.cfg index 99240e514..542a91cd0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,3 +45,7 @@ universal = 1 [pbr] skip_authors = True skip_changelog = True + +[extras] +insights = + numpy diff --git a/tox.ini b/tox.ini index 74f6f956b..5a2eb76dd 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.0 -envlist = py27,py35,py36,linters,dist +envlist = py27,py35,py36,linters,dist,insights skipsdist = True [testenv] @@ -15,6 +15,7 @@ commands = python setup.py test # py3 linters are able to stop more than py2 ones basepython = python3 whitelist_externals = bash +extras = insights commands = {[testenv:pep8]commands} bash -c "cd ansible; find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \ @@ -35,6 +36,12 @@ commands = python setup.py sdist bdist_wheel python -m twine check dist/* +[testenv:insights] +commands = + pip check + pip install .[insights] + pip check + [testenv:pep8] commands = flake8 {posargs}