From ec7354280a2ab2f08bfbc9afc992143183208edd Mon Sep 17 00:00:00 2001 From: Natalie Schultz <90212258+nataliejschultz@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:02:08 -0600 Subject: [PATCH] More edits compose: Removing healthcheck since the new image is running much faster start tests script: Modified with Shankari's suggestions + removing sleep functionality nominatim.py: updating URL + adding potentially helpful print statements workflow file: adding in commented section for schedule; will un-comment out once everything is good! --- .github/workflows/nominatim-docker-test.yml | 4 ++++ emission/integrationTests/docker-compose.yml | 6 ------ .../integrationTests/start_integration_tests.sh | 8 ++------ emission/net/ext_service/geocoder/nominatim.py | 15 +++++++-------- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.github/workflows/nominatim-docker-test.yml b/.github/workflows/nominatim-docker-test.yml index 4c8fc3616..7c15657c7 100644 --- a/.github/workflows/nominatim-docker-test.yml +++ b/.github/workflows/nominatim-docker-test.yml @@ -9,8 +9,12 @@ on: push: branches: - nominatim + # paths: + # - 'net/ext_service/geocoder' + # - 'analysis/intake/cleaning/clean_and_resample.py' # schedule: + # # Run every Sunday at 4:05 am # - cron: '5 4 * * 0' jobs: diff --git a/emission/integrationTests/docker-compose.yml b/emission/integrationTests/docker-compose.yml index 381d85701..ede0a114d 100644 --- a/emission/integrationTests/docker-compose.yml +++ b/emission/integrationTests/docker-compose.yml @@ -44,12 +44,6 @@ services: container_name: rhodeisland-nominatim ports: - "8080:8080" - # healthcheck currently commented out, since it isn't necessary and keeps going the entire time the container is running. - healthcheck: - test: ["CMD", "curl", "-v", "http://localhost:8080"] - interval: 1m - timeout: 15s - retries: 3 deploy: replicas: 1 restart_policy: diff --git a/emission/integrationTests/start_integration_tests.sh b/emission/integrationTests/start_integration_tests.sh index 1a8143352..cb03b415b 100644 --- a/emission/integrationTests/start_integration_tests.sh +++ b/emission/integrationTests/start_integration_tests.sh @@ -23,14 +23,10 @@ source setup/setup_tests.sh echo "Running tests..." source setup/activate_tests.sh -echo "Adding permissions" +echo "Adding permissions for the `runIntegrationTests.sh` script" chmod +x runIntegrationTests.sh -echo "Permissions added" +echo "Permissions added for the `runIntegrationTests.sh` script" -# tail -f /dev/null -# echo "About to sleep! Zzzz..." -# sleep 240 -# echo "Done sleeping! Running integration tests:" echo "Dockerize running!" dockerize -wait http://rhodeisland-nominatim:8080 -timeout 240s echo "Dockerize done! Running integration tests:" diff --git a/emission/net/ext_service/geocoder/nominatim.py b/emission/net/ext_service/geocoder/nominatim.py index 4c3f8e0ac..d9483ac7a 100644 --- a/emission/net/ext_service/geocoder/nominatim.py +++ b/emission/net/ext_service/geocoder/nominatim.py @@ -13,12 +13,12 @@ from emission.core.wrapper.trip_old import Coordinate try: - NOMINATIM_QUERY_URL_env = os.environ.get("NOMINATIM_QUERY_URL", "") - logging.info(f"NOMINATIM_QUERY_URL_env: {NOMINATIM_QUERY_URL_env}") - NOMINATIM_QUERY_URL = NOMINATIM_QUERY_URL_env if NOMINATIM_QUERY_URL_env != "" else "http://nominatim.openstreetmap.org" - + OPENSTREETMAP_QUERY_URL_env = os.environ.get("OPENSTREETMAP_QUERY_URL", "") + logging.info(f"OPENSTREETMAP_QUERY_URL_env: {OPENSTREETMAP_QUERY_URL_env}") + OPENSTREETMAP_QUERY_URL = OPENSTREETMAP_QUERY_URL_env if OPENSTREETMAP_QUERY_URL_env != "" else "http://nominatim.openstreetmap.org" + print("Open Street Map URL not configured, defaulting to nominatim:") if OPENSTREETMAP_QUERY_URL = "http://nominatim.openstreetmap.org" elif print "Open Street Map URL configured!" except: - print("nominatim not configured either, place decoding must happen on the client") + print("URL not configured, place decoding must happen on the client") class Geocoder(object): @@ -31,8 +31,7 @@ def make_url_geo(cls, address): "q" : address, "format" : "json" } -#testing calling by the name of the service/network - query_url = NOMINATIM_QUERY_URL + "/search?" + query_url = OPENSTREETMAP_QUERY_URL + "/search?" encoded_params = urllib.parse.urlencode(params) url = query_url + encoded_params logging.debug("For geocoding, using URL %s" % url) @@ -60,7 +59,7 @@ def make_url_reverse(cls, lat, lon): "format" : "json" } - query_url = NOMINATIM_QUERY_URL + "/reverse?" + query_url = OPENSTREETMAP_QUERY_URL + "/reverse?" encoded_params = urllib.parse.urlencode(params) url = query_url + encoded_params logging.debug("For reverse geocoding, using URL %s" % url)