From ad257b66f8acd86b8b3d3344861ee2910e4a3826 Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Thu, 8 Aug 2024 12:27:39 -0700 Subject: [PATCH 1/5] Increase COG batch attempts to 5 Should move it back up, now that Justin add code to save results of intermediate steps. We may need an attempt to make progress on each intermediate step, and there might be one or two attempts that are cut so short they make no progress. --- app/models/pydantic/jobs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/pydantic/jobs.py b/app/models/pydantic/jobs.py index d5f6bb45..29535800 100644 --- a/app/models/pydantic/jobs.py +++ b/app/models/pydantic/jobs.py @@ -145,7 +145,7 @@ class GDALCOGJob(Job): vcpus = 8 memory = 64000 num_processes = 8 - attempts = 2 + attempts = 5 attempt_duration_seconds = int(DEFAULT_JOB_DURATION * 1.5) From 5678458036c570da7c67cc1863abcab6186a8c67 Mon Sep 17 00:00:00 2001 From: Dan Scales Date: Sun, 11 Aug 2024 16:52:47 -0700 Subject: [PATCH 2/5] Fix export_to_gee.py to export COG file at {implementation}.tif Fix needed since cogify.sh changed to generated ${IMPLEMENTATION.tif} --- batch/python/export_to_gee.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/batch/python/export_to_gee.py b/batch/python/export_to_gee.py index af3ab6a0..235fa0d6 100644 --- a/batch/python/export_to_gee.py +++ b/batch/python/export_to_gee.py @@ -1,5 +1,13 @@ #!/usr/bin/env python +# Required options: +# --dataset {dataset} +# --implementation {implementation} +# +# Assumes that the cog file to be uploaded is available at {implementation}.tif +# Uploads the cog file to GCS at {GCS_BUCKET}/{dataset}/{implementation}.tif and +# creates a GEE asset that links to that GCS URI. + import json import os @@ -35,7 +43,7 @@ def upload_cog_to_gcs(dataset, implementation): bucket = storage_client.bucket(GCS_BUCKET) blob = bucket.blob(f"{dataset}/{implementation}.tif") - blob.upload_from_filename("cog.tif") + blob.upload_from_filename(f"{implementation}.tif") return f"gs://{GCS_BUCKET}/{dataset}/{implementation}.tif" @@ -44,7 +52,7 @@ def create_cog_backed_asset(dataset, implementation, gcs_path, service_account): credentials = ee.ServiceAccountCredentials(service_account, GCS_CREDENTIALS_FILE) ee.Initialize(credentials) - # delete any existing asset with the same dataset/implementatio + # delete any existing asset with the same dataset/implementation try: ee.data.deleteAsset(f"projects/{EE_PROJECT}/assets/{dataset}/{implementation}") except ee.EEException: From ccc2cea0227294255e68ac71624672947c620f29 Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Mon, 12 Aug 2024 19:01:05 +0300 Subject: [PATCH 3/5] attach lambda to allow passing api key as query parameter --- terraform/modules/api_gateway/gateway/main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/modules/api_gateway/gateway/main.tf b/terraform/modules/api_gateway/gateway/main.tf index 61fe4ac2..ffbed151 100644 --- a/terraform/modules/api_gateway/gateway/main.tf +++ b/terraform/modules/api_gateway/gateway/main.tf @@ -48,7 +48,7 @@ module "query_get" { require_api_key = true http_method = "GET" - authorization = "NONE" + authorization = "CUSTOM" integration_parameters = { "integration.request.path.version" = "method.request.path.version" @@ -75,7 +75,7 @@ module "query_post" { require_api_key = true http_method = "POST" - authorization = "NONE" + authorization = "CUSTOM" integration_parameters = { "integration.request.path.version" = "method.request.path.version" From c79cfff65cd37448bf526e643f2bc09ce50fd99d Mon Sep 17 00:00:00 2001 From: Daniel Mannarino Date: Tue, 20 Aug 2024 01:37:44 -0400 Subject: [PATCH 4/5] Harmless comment --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index f6e52816..e16f0d8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10-slim +# Comment to trigger an image rebuild + # Optional build argument for different environments ARG ENV From 0fb62e6bb481e102764cbed84328ed5543d0f5e3 Mon Sep 17 00:00:00 2001 From: jterry64 Date: Wed, 21 Aug 2024 18:43:01 -0700 Subject: [PATCH 5/5] Set SPARSE_OK=TRUE for COGs (#577) --- batch/scripts/cogify.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/batch/scripts/cogify.sh b/batch/scripts/cogify.sh index 3fb2d40b..2d44efe8 100755 --- a/batch/scripts/cogify.sh +++ b/batch/scripts/cogify.sh @@ -38,7 +38,7 @@ else fi # convert to COG using existing overviews, this adds some additional layout optimizations -gdal_translate "${IMPLEMENTATION}_merged.tif" "${IMPLEMENTATION}.tif" -of COG -co COMPRESS=DEFLATE -co BLOCKSIZE="${BLOCK_SIZE}" -co BIGTIFF=IF_SAFER -co NUM_THREADS=ALL_CPUS -co OVERVIEWS=FORCE_USE_EXISTING --config GDAL_CACHEMAX 70% --config GDAL_NUM_THREADS ALL_CPUS +gdal_translate "${IMPLEMENTATION}_merged.tif" "${IMPLEMENTATION}.tif" -of COG -co COMPRESS=DEFLATE -co BLOCKSIZE="${BLOCK_SIZE}" -co BIGTIFF=IF_SAFER -co NUM_THREADS=ALL_CPUS -co OVERVIEWS=FORCE_USE_EXISTING -co SPARSE_OK=TRUE --config GDAL_CACHEMAX 70% --config GDAL_NUM_THREADS ALL_CPUS # upload to data lake aws s3 cp "${IMPLEMENTATION}.tif" "${TARGET}"