Skip to content

Commit a0cbc97

Browse files
author
Abhishek Singh
committed
Version 0.9.99 changes
1. Test Coverage -> Fixed Test report coverage. The Python Server process's coverage was not being reported. 2. Unitest -> Use pytest fixtures for unittesting. Organized test cases. 3. SQLiteClient -> Fix in retry logic. Retry was not sending the request(again), it was simply polling the REQ Socket. 4. SQLiteServer -> Removed server.stop method. Keyboard interupt handling is handled in server.start() method 5. Serialization -> Changed msgpack-python to faster and efficient msgpack 6. Exceptions - The SQLiteClient will not raise an SQLiteRxConnectionError exception if the server is offline. 7. Exceptions - Renamed the error classes. SQLiteRxCompressionError, SQLiteRxConnectionError, SQLiteRxTransportError SQLiteRxSerializationError
1 parent 229da55 commit a0cbc97

29 files changed

Lines changed: 457 additions & 526 deletions

.coveragerc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
parallel = True
33
branch = False
44
source = sqlite_rx
5+
concurrency = multiprocessing
56
omit =
67
/*/tests/*
78
.env/*
8-
/sqlite_rx/cli
9+
./sqlite_rx/cli/__init__.py
910
/home/travis/virtualenv/*
1011

1112
[report]

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ dist
88
sqlite_rx.egg-info
99
.coveragerc
1010
docker_examples
11+
.coverage
12+
.pytest_cache
13+
.coverage

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ sqlite_rx.egg-info/
55
cover/
66
build/
77
dist/
8+
.coverage
9+
.pytest_cache
810
.coverage

.travis.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,18 @@ matrix:
33
include:
44
- os: linux
55
python: 3.6
6-
env:
7-
- SITECUSTOMIZELIBPATH=/home/travis/virtualenv/python3.6/lib/python3.6/site-packages/sitecustomize.py
8-
- COVERAGE_PROCESS_START=${TRAVIS_BUILD_DIR}/.coveragerc
96
- os: linux
107
python: 3.7
11-
env:
12-
- SITECUSTOMIZELIBPATH=/home/travis/virtualenv/python3.7/lib/python3.7/site-packages/sitecustomize.py
13-
- COVERAGE_PROCESS_START=${TRAVIS_BUILD_DIR}/.coveragerc
148
- os: linux
159
python: 3.8
16-
env:
17-
- SITECUSTOMIZELIBPATH=/home/travis/virtualenv/python3.8/lib/python3.8/site-packages/sitecustomize.py
18-
- COVERAGE_PROCESS_START=${TRAVIS_BUILD_DIR}/.coveragerc
1910
- os: linux
2011
python: pypy3
21-
env:
22-
- SITECUSTOMIZELIBPATH=/home/travis/virtualenv/pypy3/site-packages/sitecustomize.py
23-
- COVERAGE_PROCESS_START=${TRAVIS_BUILD_DIR}/.coveragerc
12+
install:
13+
- pip install --upgrade pip
14+
- pip install pytest pytest-cov coverage coveralls
15+
- pip install -e .
2416
script:
25-
- cp ${TRAVIS_BUILD_DIR}/.travis/sitecustomize.py ${SITECUSTOMIZELIBPATH}
26-
- cat ${SITECUSTOMIZELIBPATH}
27-
- pip install nose
28-
- pip install coverage
29-
- pip install coveralls
30-
- python -m site
31-
- python --version
32-
- python setup.py nosetests --with-coverage
33-
- coverage run --concurrency=multiprocessing -m unittest discover -s sqlite_rx/tests
17+
- coverage run -m pytest --verbose sqlite_rx/tests
3418
- coverage combine
3519
- coverage report -i -m
3620
- coveralls

.travis/sitecustomize.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
click
2-
msgpack-python
2+
msgpack
33
pyzmq
44
tornado

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
PACKAGES = ['sqlite_rx']
2222

23-
DEPENDENCIES = ['msgpack-python', 'pyzmq', 'tornado', 'click']
23+
DEPENDENCIES = ['msgpack', 'pyzmq', 'tornado', 'click']
2424

2525
classifiers = [
2626
'Development Status :: 4 - Beta',

sqlite_rx/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.9.98"
1+
__version__ = "0.9.99"
22
__author__ = "Abhishek Singh"
33
__authoremail__ = "aosingh@asu.edu"
44

@@ -39,4 +39,8 @@ def get_default_logger_settings(level: str = "DEBUG"):
3939
'propagate': False
4040
},
4141
}
42-
}
42+
}
43+
44+
45+
def get_version():
46+
return __version__

sqlite_rx/cli/__init__.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def main(log_level,
2929
curve_dir,
3030
key_id):
3131
logging.config.dictConfig(get_default_logger_settings(level=log_level))
32-
LOG.info("Python Platform %s" % platform.python_implementation())
32+
LOG.info("Python Platform %s", platform.python_implementation())
3333
kwargs = {
3434
'bind_address': f'tcp://{advertise_host}:{port}',
3535
'database': database,
@@ -38,18 +38,9 @@ def main(log_level,
3838
'use_encryption': curvezmq,
3939
'server_curve_id': key_id
4040
}
41-
LOG.info('Args %s' % pformat(kwargs))
41+
LOG.info('Args %s', pformat(kwargs))
4242
server = SQLiteServer(**kwargs)
43-
try:
44-
server.start()
45-
except KeyboardInterrupt:
46-
LOG.warning("Keyboard Interrupt")
47-
server.stop()
48-
except Exception:
49-
LOG.exception("Exception in Server Thread")
50-
server.stop()
51-
raise
52-
43+
server.start()
5344

5445

5546

sqlite_rx/client.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,22 @@ def execute(self,
178178
raise SQLiteRxConnectionError("No response after retrying. Abandoning Request")
179179

180180
def shutdown(self):
181-
self._client.setsockopt(zmq.LINGER, 0)
182-
self._client.close()
183-
self._poller.unregister(self._client)
181+
try:
182+
self._client.setsockopt(zmq.LINGER, 0)
183+
self._client.close()
184+
self._poller.unregister(self._client)
185+
except zmq.ZMQError as e:
186+
if e.errno in (zmq.EINVAL,
187+
zmq.EPROTONOSUPPORT,
188+
zmq.ENOCOMPATPROTO,
189+
zmq.EADDRINUSE,
190+
zmq.EADDRNOTAVAIL,):
191+
LOG.error("ZeroMQ Transportation endpoint was not setup")
192+
193+
elif e.errno in (zmq.ENODEV, zmq.ENOTSOCK,):
194+
LOG.error("ZeroMQ request was made against a non-existent device or invalid socket")
195+
196+
elif e.errno in (zmq.ETERM, zmq.EMTHREAD,):
197+
LOG.error("ZeroMQ context is not a state to handle this request for socket")
198+
except Exception:
199+
LOG.exception("Exception while shutting down SQLiteClient")

0 commit comments

Comments
 (0)