Commit 8e427040 authored by Thorsten Simons's avatar Thorsten Simons

1.3.8 - fixed a bug that caused log packages to fail if they contained HCP-S...

1.3.8 - fixed a bug that caused log packages to fail if they contained HCP-S logs; Fixed a bug that caused a crash in analyze when a query didn't return any data; made using *setproctitle* optional when installing through pip for
    environments that are not supported (CygWin, for example)
parent 2f3a37e0
Release History
===============
**1.3.8 2017-12-07**
* fixed a bug that caused log packages to fail if they contained HCP-S logs
* Fixed a bug that caused a crash in analyze when a query didn't return any
data
* made using *setproctitle* optional when installing through pip for
environments that are not supported (CygWin, for example)
**1.3.7 2017-12-07**
* fixed setup.py to include pre-requisite *setproctitle*
......
......@@ -23,7 +23,11 @@
import sys
from time import time
from os.path import exists, join, dirname
from setproctitle import setproctitle
from traceback import print_exc
try:
from setproctitle import setproctitle
except ImportError:
setproctitle = None
from hcpreq import parseargs
from hcpreq.db import DB
......@@ -78,7 +82,9 @@ def main():
elif opts.cmd == 'load':
if not exists(opts.logpkg):
sys.exit('fatal: log package {} not existent'.format(opts.logpkg))
setproctitle('hcprequestanalytics is loading {}'.format(opts.logpkg))
if setproctitle:
setproctitle('hcprequestanalytics is loading {}'
.format(opts.logpkg))
db = opendb(opts.db, None)
start1 = time()
......@@ -104,7 +110,8 @@ def main():
# run queries against the database
elif opts.cmd == 'analyze':
setproctitle('hcprequestanalytics is analyzing {}'.format(opts.db))
if setproctitle:
setproctitle('hcprequestanalytics is analyzing {}'.format(opts.db))
db = opendb(opts.db, opts.additionalqueries)
try:
_st = time()
......@@ -112,6 +119,7 @@ def main():
processes=opts.processes)
print('analytics finished after {:.3f} seconds'.format(time()-_st))
except Exception as e:
# print_exc()
print('analyze failed: {}'.format(e))
db.close()
......
......@@ -29,7 +29,10 @@ from datetime import datetime
from collections import OrderedDict
from concurrent.futures import ProcessPoolExecutor, as_completed, TimeoutError
from tempfile import NamedTemporaryFile
from setproctitle import setproctitle
try:
from setproctitle import setproctitle
except ImportError:
setproctitle = None
from hcpreq.queries import Queries
from hcpreq.xlsx import Csv, Xlsx
......@@ -260,8 +263,16 @@ class DB():
print('\t{} generated an exception: {}'.format(mps[fu], e),
flush=True)
else:
print('\t{:30}: {}'.format(mps[fu], mktimestr(runtime)),
flush=True)
if not data:
# make sure we don't crash if we don't have any data
print( '\t{:30}: {} - no data'
.format(mps[fu], mktimestr(runtime)),
flush=True)
continue
else:
print('\t{:30}: {}'.format(mps[fu], mktimestr(runtime)),
flush=True)
first = True
for rec in data:
if first:
......@@ -306,7 +317,8 @@ def runquery(db, qtitle, query):
:param query: the query
:return: a list of sqlite3.Row objects
"""
setproctitle('hcprequestanalytics query worker')
if setproctitle:
setproctitle('hcprequestanalytics query worker')
# just open this temporary file to be able to identify which query a
# subprocess is running ;-)
......
......@@ -22,6 +22,7 @@ from tempfile import TemporaryDirectory
from shutil import unpack_archive
from os import listdir, walk
from os.path import join
from ipaddress import ip_address
class Handler(object):
......@@ -120,9 +121,15 @@ class Handler(object):
if not relevant:
continue
else:
# if we find an empty line, stop - we have what we need.
if not l.strip():
break
cols = l.split(',')
# if we don't find an IP address in col[0], skip this entry
try:
ip_address(cols[0])
except ValueError:
continue
# if we have Nodes with an BE IP address with the last
# octet being 1- or 2-digit, only, we need to fix that
# and make it 3-digit, as the de-compressed folder will
......
......@@ -99,10 +99,14 @@ class Xlsx(Csv):
self.linkback = self.wb.add_format({'bold': True,
'font_size': 14,
'color': 'blue',
'bg_color': 'yellow'})
'bg_color': 'yellow',
'align': 'center'})
self.title0 = self.wb.add_format({'bold': False,
'font_size': 14,
'bg_color': 'yellow'})
self.title1 = self.wb.add_format({'bold': False,
'font_size': 14,
'bg_color': 'yellow'})
self.title = self.wb.add_format({'bold': True,
'font_size': 14,
'bg_color': 'yellow',
......@@ -134,10 +138,11 @@ class Xlsx(Csv):
# write the comment into the header, plus a link to the CONTENT sheet
self.ws.set_row(0, 20, self.title0)
self.ws.merge_range(0, 0, 0, 7, comment)
self.ws.merge_range(0, 8, 0, 10, '', self.title0)
self.ws.write_url(0, 8, 'internal:CONTENT!B2', self.linkback,
'<<< back to CONTENT <<<')
self.ws.merge_range(0, 0, 0, 1, '', self.title1)
self.ws.write_url(0, 0, 'internal:CONTENT!B2', self.linkback,
'<<< back <<<', )
self.ws.merge_range(0, 2, 0, 10, comment)
# insert a spacer row
self.ws.set_row(1, 8, self.title0)
# write the field names
......
......@@ -95,13 +95,13 @@ setup(
# project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/technical.html#install-requires-vs-requirements-files
install_requires=['setproctitle==1.1.10', 'xlsxwriter==1.0.0'],
install_requires=['xlsxwriter==1.0.0'],
# List additional groups of dependencies here (e.g. development dependencies).
# You can install these using the following syntax, for example:
# $ pip install -e .[dev,test]
# extras_require = {'dev': ['Sphinx'],
# },
extras_require = {'setproctitle': ['setproctitle==1.1.10'],
},
# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
......
......@@ -27,7 +27,7 @@ class Gvars:
"""
# version control
s_version = "1.3.7"
s_version = "1.3.8"
s_builddate = '2017-12-07'
s_build = "{}/Sm".format(s_builddate)
s_minPython = "3.4.3"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment