Skip to content

Commit

Permalink
More edits
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
nataliejschultz committed Sep 28, 2023
1 parent 4c9c915 commit ec73542
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/nominatim-docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 0 additions & 6 deletions emission/integrationTests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 2 additions & 6 deletions emission/integrationTests/start_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand Down
15 changes: 7 additions & 8 deletions emission/net/ext_service/geocoder/nominatim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ec73542

Please sign in to comment.