Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Finish removing UUID components #325

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions docker/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def verify_checksum(md5_file, path):


def set_env_vars(region, subregion, srid, language, pgosm_date, layerset,
layerset_path, sp_gist, replication, import_uuid):
layerset_path, sp_gist, replication):
"""Sets environment variables needed by PgOSM Flex. Also creates DB
record in `osm.pgosm_flex` table.

Expand All @@ -108,16 +108,13 @@ def set_env_vars(region, subregion, srid, language, pgosm_date, layerset,
When `True` uses SP-GIST index instead of GIST for spatial indexes.
replication : bool
Indicates when osm2pgsql-replication is used
import_uuid : uuid
Required to track import failures in Postgres between Python and Lua
"""
logger = logging.getLogger('pgosm-flex')
logger.debug('Ensuring env vars are not set from prior run')
unset_env_vars()
logger.debug('Setting environment variables')

os.environ['PGOSM_REGION'] = region
os.environ['PGOSM_IMPORT_UUID'] = str(import_uuid)


if srid != DEFAULT_SRID:
Expand Down Expand Up @@ -215,4 +212,3 @@ def unset_env_vars():
os.environ.pop('PGOSM_CONN_PG', None)
os.environ.pop('PGOSM_GIST_TYPE', None)
os.environ.pop('PGOSM_REPLICATION', None)
os.environ.pop('PGOSM_IMPORT_UUID', None)
6 changes: 1 addition & 5 deletions docker/pgosm_flex.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import sys

import click
import uuid

import osm2pgsql_recommendation as rec
import db
Expand Down Expand Up @@ -94,11 +93,8 @@ def run_pgosm_flex(ram, region, subregion, debug,
if region is None and input_file:
region = input_file


import_uuid = uuid.uuid4()
helpers.set_env_vars(region, subregion, srid, language, pgosm_date,
layerset, layerset_path, sp_gist, replication,
import_uuid)
layerset, layerset_path, sp_gist, replication)
db.wait_for_postgres()

if replication:
Expand Down
8 changes: 2 additions & 6 deletions docker/tests/test_geofabrik.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
""" Unit tests to cover the Geofabrik module."""
import unittest
import uuid

import geofabrik, helpers

Expand All @@ -9,7 +8,6 @@
LAYERSET = 'default'
PGOSM_DATE = '2021-12-02'

IMPORT_UUID = uuid.uuid4()

class GeofabrikTests(unittest.TestCase):

Expand All @@ -22,8 +20,7 @@ def setUp(self):
layerset=LAYERSET,
layerset_path=None,
sp_gist=False,
replication=False,
import_uuid=IMPORT_UUID)
replication=False)


def tearDown(self):
Expand All @@ -45,8 +42,7 @@ def test_get_region_filename_returns_region_when_subregion_None(self):
layerset=LAYERSET,
layerset_path=None,
sp_gist=False,
replication=False,
import_uuid=IMPORT_UUID)
replication=False)

result = geofabrik.get_region_filename()
expected = f'{REGION_US}-latest.osm.pbf'
Expand Down
8 changes: 2 additions & 6 deletions docker/tests/test_pgosm_flex.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
""" Unit tests to cover the DB module."""
import unittest
import uuid

import pgosm_flex, helpers

Expand All @@ -9,7 +8,6 @@
SUBREGION_DC = 'district-of-columbia'
LAYERSET = 'default'
PGOSM_DATE = '2021-12-02'
IMPORT_UUID = uuid.uuid4()

class PgOSMFlexTests(unittest.TestCase):

Expand All @@ -22,8 +20,7 @@ def setUp(self):
layerset=LAYERSET,
layerset_path=None,
sp_gist=False,
replication=False,
import_uuid=IMPORT_UUID)
replication=False)


def tearDown(self):
Expand Down Expand Up @@ -95,8 +92,7 @@ def test_get_export_filename_region_only(self):
layerset=LAYERSET,
layerset_path=None,
sp_gist=False,
replication=False,
import_uuid=IMPORT_UUID)
replication=False)

input_file = None
result = pgosm_flex.get_export_filename(input_file)
Expand Down