From d6ad0bb966ec0ffc92d1c79a2775d391d01188cb Mon Sep 17 00:00:00 2001 From: Rub21 Date: Tue, 17 Dec 2024 19:47:30 -0500 Subject: [PATCH] Update config tiler purge for production --- images/tiler-imposm/start.sh | 22 +++++++++++++++++++--- images/tiler-imposm/update_tables.py | 17 +++++++++++++++++ values.production.template.yaml | 2 +- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/images/tiler-imposm/start.sh b/images/tiler-imposm/start.sh index 6f97454c..fdf8a302 100755 --- a/images/tiler-imposm/start.sh +++ b/images/tiler-imposm/start.sh @@ -123,9 +123,25 @@ function updateData() { # Check if the limit file exists if [ -z "$TILER_IMPORT_LIMIT" ]; then - imposm run -config "$WORKDIR/config.json" -expiretiles-dir "$IMPOSM3_EXPIRE_DIR" -httpprofile ":6060" & + # imposm run -config "$WORKDIR/config.json" -expiretiles-dir "$IMPOSM3_EXPIRE_DIR" -httpprofile ":6060" & + imposm run \ + -config "${WORKDIR}/config.json" \ + -cachedir "${CACHE_DIR}" \ + -diffdir "${DIFF_DIR}" \ + -commit-latest \ + -replication-interval 1m \ + -expiretiles-dir "${EXPIRE_DIR}" \ + -quiet & else - imposm run -config "$WORKDIR/config.json" -limitto "$WORKDIR/$LIMITFILE" -expiretiles-dir "$IMPOSM3_EXPIRE_DIR" & + imposm run \ + -config "${WORKDIR}/config.json" \ + -cachedir "${CACHE_DIR}" \ + -diffdir "${DIFF_DIR}" \ + -commit-latest \ + -replication-interval 1m \ + -limitto "${WORKDIR}/${LIMITFILE}" \ + -expiretiles-dir "${EXPIRE_DIR}" \ + -quiet & fi while true; do @@ -172,9 +188,9 @@ function importData() { -deployproduction # These index will help speed up tegola tile generation - # psql $PG_CONNECTION -f queries/postgis_index.sql psql $PG_CONNECTION -f queries/postgis_post_import.sql + # To not import again touch $INIT_FILE # Update tables diff --git a/images/tiler-imposm/update_tables.py b/images/tiler-imposm/update_tables.py index b442c9eb..d116e697 100644 --- a/images/tiler-imposm/update_tables.py +++ b/images/tiler-imposm/update_tables.py @@ -120,8 +120,25 @@ def create_triggers(generalized_tables): trigger_function = f""" CREATE OR REPLACE FUNCTION {fixed_table_name}_transform_trigger() RETURNS TRIGGER AS $$ + DECLARE + start_time TIMESTAMP; + end_time TIMESTAMP; + elapsed_time INTERVAL; BEGIN + -- Record the start time + start_time := clock_timestamp(); + + -- Perform the transformation NEW.geometry = {geometry_transform.replace('geometry', 'NEW.geometry')}; + + -- Record the end time + end_time := clock_timestamp(); + elapsed_time := end_time - start_time; + + -- Log the time taken and the object being updated + RAISE NOTICE 'Table: %, ID: %, Time Taken: % ms', + TG_TABLE_NAME, NEW.id, EXTRACT(MILLISECOND FROM elapsed_time); + RETURN NEW; END; $$ LANGUAGE plpgsql; diff --git a/values.production.template.yaml b/values.production.template.yaml index 2975cc7d..7040d2df 100644 --- a/values.production.template.yaml +++ b/values.production.template.yaml @@ -931,7 +931,7 @@ ohm: NAMESPACE: default # Namespace to run the job DOCKER_IMAGE: ghcr.io/openhistoricalmap/tiler-server:0.0.1-0.dev.git.1920.h4abe268 # TODO, this should be automatically updated from tiler server image SQS_QUEUE_URL: {{PRODUCTION_SQS_QUEUE_URL}} - NODEGROUP_TYPE: job_large_tiler # Nodegroup type to run the purge and seed job + NODEGROUP_TYPE: web_large # Nodegroup type to run the purge and seed job # Maximum number of active jobs in high concurrency queue MAX_ACTIVE_JOBS: 10 DELETE_OLD_JOBS_AGE: 7200 # 2 hours