Skip to content

Commit

Permalink
Merge branch 'release/2.0.1'
Browse files Browse the repository at this point in the history
* release/2.0.1:
  bump version
  bumo version
  fixes PDIndicator decimal
  bump version
  • Loading branch information
saxix committed Sep 1, 2019
2 parents 00e647b + dcbccfa commit bbe3762
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.0.0rc22
current_version = 2.0.1
commit = False
tag = False
allow_dirty = True
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ARG BASE_IMAGE
# && curl -L -u "${GITHUB_TOKEN}:" "https://github.com/unicef/etools-datamart/archive/${DATAMART_VERSION}.tar.gz" | tar -xzf - --strip-components=1; \
# fi

FROM unicef/datamart-base:${BASE_IMAGE}
FROM unicef/datamart:${BASE_IMAGE}-base
#COPY --from=loader /code /code

ARG BUILD_DATE
Expand Down Expand Up @@ -105,6 +105,7 @@ ENV UWSGI_PROTOCOL=http \
UWSGI_DISABLE_LOGGING=false \
UWSGI_DISABLE_WRITE_EXCEPTION=true \
UWSGI_FREEBIND=true \
UWSGI_HARAKIRI=120 \
UWSGI_HTTP_TIMEOUT=60 \
UWSGI_IGNORE_SIGPIPE=true \
UWSGI_IGNORE_WRITE_ERRORS=true \
Expand Down
6 changes: 3 additions & 3 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DATABASE_URL_ETOOLS?=
DEVELOP?=1
DOCKER_PASS?=
DOCKER_USER?=
TARGET?=2.0.0rc22
TARGET?=2.0.1
BASE=2.0
# below vars are used internally
BUILD_OPTIONS?=--squash
Expand All @@ -30,10 +30,10 @@ build-base:
cd .. && docker build \
${BUILD_OPTIONS} \
--no-cache \
-t ${DOCKER_IMAGE_NAME}-base:${BASE} \
-t ${DOCKER_IMAGE_NAME}:${BASE}-base \
-f docker/Dockerfile.base .
@echo ${DOCKER_PASS} | docker login -u ${DOCKER_USER} --password-stdin
docker push ${DOCKER_IMAGE_NAME}-base:${BASE}
docker push ${DOCKER_IMAGE_NAME}:${BASE}-base


.build:
Expand Down
2 changes: 1 addition & 1 deletion src/etools_datamart/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import warnings

NAME = 'etools-datamart'
VERSION = __version__ = '2.0.0rc22'
VERSION = __version__ = '2.0.1'
__author__ = ''

# UserWarning: The psycopg2 wheel package will be renamed from release 2.8;
Expand Down
3 changes: 1 addition & 2 deletions src/etools_datamart/apps/data/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,9 @@ def load(self, *, verbosity=0, always_update=False, stdout=None,
self.results.context = self.context
self.fields_to_compare = [f for f in self.mapping.keys() if f not in ["seen"]]
if truncate:
cache.set("STATUS:%s" % self.etl_task.task, '[truncating]')
self.model.objects.truncate()
for i, country in enumerate(countries, 1):
cache.set("STATUS:%s" % self.etl_task.task, country)
cache.set("STATUS:%s" % self.etl_task.task, "%s - %s" % (country, self.results.processed))
self.context['country'] = country
if stdout and verbosity > 0:
stdout.write(f"{i:>3}/{total_countries} "
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 2.2.4 on 2019-09-01 06:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('data', '0088_auto_20190828_2216'),
]

operations = [
migrations.AlterField(
model_name='pdindicator',
name='baseline_denominator',
field=models.DecimalField(blank=True, decimal_places=3, max_digits=20, null=True),
),
migrations.AlterField(
model_name='pdindicator',
name='baseline_numerator',
field=models.DecimalField(blank=True, decimal_places=3, max_digits=20, null=True),
),
]
4 changes: 2 additions & 2 deletions src/etools_datamart/apps/data/models/pd_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class PDIndicator(LocationMixin, DataMartModel):

# baseline = models.TextField(blank=True, null=True) # This field type is a guess.
baseline_denominator = models.DecimalField(blank=True, null=True,
max_digits=8, decimal_places=3)
max_digits=20, decimal_places=3)
baseline_numerator = models.DecimalField(blank=True, null=True,
max_digits=8, decimal_places=3)
max_digits=20, decimal_places=3)

# from lower_result
lower_result_name = models.CharField(max_length=500, blank=True, null=True)
Expand Down
2 changes: 1 addition & 1 deletion src/etools_datamart/apps/etl/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def _last_failure(self, obj):

def _status(self, obj):
css = get_css(obj)
if 'RETRY' in obj.status:
if obj.status and 'RETRY' in obj.status:
s = '%s</br>%s' % (obj.status, obj.results)
else:
c = cache.get("STATUS:%s" % obj.task) or ""
Expand Down
1 change: 1 addition & 0 deletions src/unicef_rest_framework/renderers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
from .pdf import PDFRenderer # noqa
from .txt import TextRenderer # noqa
from .xls import XLSXRenderer # noqa
from .yaml import YAMLRenderer # noqa
29 changes: 29 additions & 0 deletions src/unicef_rest_framework/renderers/yaml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import logging

from crashlog.middleware import process_exception
from rest_framework_yaml.renderers import YAMLRenderer as BaseRenderer

from unicef_rest_framework.renderers.mixin import ContentDispositionMixin

logger = logging.getLogger(__name__)


def labelize(v):
return v.replace("_", " ").title()


class YAMLRenderer(ContentDispositionMixin, BaseRenderer):
format = 'yaml'

def render(self, data, accepted_media_type=None, renderer_context=None):
response = renderer_context['response']
self.process_response(renderer_context)
if response.status_code != 200:
return ''
try:
return super().render(data, accepted_media_type, renderer_context)

except Exception as e:
process_exception(e)
logger.exception(e)
raise Exception(f'Error processing request {e}') from e
5 changes: 2 additions & 3 deletions src/unicef_rest_framework/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from rest_framework import viewsets
from rest_framework.authentication import BasicAuthentication, SessionAuthentication, TokenAuthentication
from rest_framework_xml.renderers import XMLRenderer
from rest_framework_yaml.renderers import YAMLRenderer
from strategy_field.utils import fqn

from unicef_rest_framework.pagination import PageFilter
Expand All @@ -21,8 +20,8 @@
from .negotiation import CT
from .ordering import OrderingFilter
from .permissions import ServicePermission
from .renderers import (CSVRenderer, HTMLRenderer, IQYRenderer, JSONRenderer, MSJSONRenderer,
MSXmlRenderer, PDFRenderer, TextRenderer, URFBrowsableAPIRenderer, XLSXRenderer,)
from .renderers import (CSVRenderer, HTMLRenderer, IQYRenderer, JSONRenderer, MSJSONRenderer, MSXmlRenderer,
PDFRenderer, TextRenderer, URFBrowsableAPIRenderer, XLSXRenderer, YAMLRenderer,)


class classproperty(object):
Expand Down

0 comments on commit bbe3762

Please sign in to comment.