Skip to content

Commit

Permalink
Merge branch 'release-v0.2.38'
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgee committed Aug 16, 2022
2 parents bc7f756 + 19c79b6 commit e97ccb5
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignore:
- "src/panoptes/utils/config/server.py"
10 changes: 6 additions & 4 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
- name: tox clean and build
run: |
tox -e clean
tox -e build
- name: tox publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
tox -e publish
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Changelog
=========

0.2.38 - 2022-08-16
-------------------

Fixed
^^^^^

* Config server doesn't initially parse config file so it doesn't need to deserialize on response.


0.2.37 - 2022-08-09
-------------------

Expand Down
5 changes: 1 addition & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,10 @@ addopts =
--cov-report xml:build/coverage.xml
--strict-markers
--doctest-modules
--test-databases memory
--strict-markers
-vv
-ra
--ignore=tests/config/test_config_cli.py
--ignore=tests/config/test_config_server.py
--ignore=src/panoptes/utils/config
--test-databases memory
norecursedirs =
dist
build
Expand Down
2 changes: 1 addition & 1 deletion src/panoptes/utils/config/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_config(key=None,
>>> # With no parsing, the raw string (including quotes) is returned.
>>> get_config(key='location.horizon', parse=False)
'"30.0 deg"'
'"30 deg"'
>>> get_config(key='cameras.devices[1].model')
'canon_gphoto2'
Expand Down
26 changes: 4 additions & 22 deletions src/panoptes/utils/config/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
from flask import Flask
from flask import jsonify
from flask import request
from flask.json import JSONEncoder
from gevent.pywsgi import WSGIServer
from loguru import logger
from scalpl import Cut

from panoptes.utils.config.helpers import load_config
from panoptes.utils.config.helpers import save_config
from panoptes.utils.serializers import serialize_object

# Turn off noisy logging for Flask wsgi server.
logging.getLogger('werkzeug').setLevel(logging.WARNING)
Expand All @@ -21,24 +19,6 @@
app = Flask(__name__)


class CustomJSONEncoder(JSONEncoder):

def default(self, obj):
"""Custom serialization of each object.
This method will call :func:`panoptes.utils.serializers.serialize_object` for
each object.
Args:
obj (`any`): The object to serialize.
"""
return serialize_object(obj)


app.json_provider_class = CustomJSONEncoder


def config_server(config_file,
host=None,
port=None,
Expand Down Expand Up @@ -72,7 +52,7 @@ def config_server(config_file,
multiprocessing.Process: The process running the config server.
"""
logger.info(f'Starting panoptes-config-server with config_file={config_file!r}')
config = load_config(config_files=config_file, load_local=load_local)
config = load_config(config_files=config_file, load_local=load_local, parse=False)
logger.success(f'Config server Loaded {len(config)} top-level items')

# Add an entry to control running of the server.
Expand Down Expand Up @@ -317,7 +297,9 @@ def reset_config():
if params['reset']:
# Reload the config
config = load_config(config_files=app.config['config_file'],
load_local=app.config['load_local'])
load_local=app.config['load_local'],
parse=params.get('parse', False)
)
# Add an entry to control running of the server.
config['config_server'] = dict(running=True)
app.config['POCS'] = config
Expand Down

0 comments on commit e97ccb5

Please sign in to comment.