From 95e2b2813d4e23180e35728f4f3f5bcfca4bd0b5 Mon Sep 17 00:00:00 2001 From: Hielke Kramer Date: Tue, 27 Oct 2020 14:59:21 +0100 Subject: [PATCH] Added better logging in importer --- deploy/import/import.sh | 5 +++-- src/bouwdossiers/batch.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/deploy/import/import.sh b/deploy/import/import.sh index c56f227..4ec91bf 100755 --- a/deploy/import/import.sh +++ b/deploy/import/import.sh @@ -1,7 +1,8 @@ #!/bin/sh -set -e -set -u +set -u # crash on missing env variables +set -e # stop on any error +set -x # print what we are doing DIR="$(dirname $0)" diff --git a/src/bouwdossiers/batch.py b/src/bouwdossiers/batch.py index e671d75..5d6e044 100644 --- a/src/bouwdossiers/batch.py +++ b/src/bouwdossiers/batch.py @@ -413,6 +413,7 @@ def import_pre_wabo_dossiers(max_file_count=None): # noqa C901 def add_bag_ids_to_wabo(): # This gets the nummeraanduidingen using the verblijfsobjecten instead of using the # address as it is done in the pre-wabo dossiers. + log.info("Add nummeraanduidingen to wabo dossiers") with connection.cursor() as cursor: cursor.execute(""" WITH adres_nummeraanduiding AS ( @@ -434,10 +435,11 @@ def add_bag_ids_to_wabo(): FROM adres_nummeraanduiding WHERE bouwdossiers_adres.id = adres_nummeraanduiding.id """) + log.info("Finished adding nummeraanduidingen to wabo dossiers") def add_bag_ids_to_pre_wabo(): - log.info("Add nummeraanduidingen") + log.info("Add nummeraanduidingen to pre-wabo dossiers") with connection.cursor() as cursor: cursor.execute(""" WITH adres_nummeraanduiding AS ( @@ -459,7 +461,8 @@ def add_bag_ids_to_pre_wabo(): nummeraanduidingen_label = adres_nummeraanduiding.nummeraanduidingen_label FROM adres_nummeraanduiding WHERE bouwdossiers_adres.id = adres_nummeraanduiding.id - """) + """) + log.info("Finished adding nummeraanduidingen to pre-wabo dossiers") log.info("Add panden") with connection.cursor() as cursor: @@ -487,7 +490,8 @@ def add_bag_ids_to_pre_wabo(): verblijfsobjecten_label = adres_pand.verblijfsobjecten_label FROM adres_pand WHERE bouwdossiers_adres.id = adres_pand.id - """) + """) + log.info("Finished adding panden") # First we try to match with openbare ruimtes that are streets 01 log.info("Add openbare ruimtes") @@ -510,6 +514,7 @@ def add_bag_ids_to_pre_wabo(): WHERE ba.straat = opr.naam AND (ba.openbareruimte_id IS NULL OR ba.openbareruimte_id = '') """) + log.info("Finished adding openbare ruimtes") def validate_import(min_bouwdossiers_count):