Skip to content

Commit

Permalink
fix: Merge in rawdata branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rsavoye committed Oct 9, 2023
2 parents d3b1b3b + efd0729 commit 967799b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 112 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@main
needs: [extract-vars]
with:
context: .
build_target: ci
image_tags: |
"ghcr.io/hotosm/osm-fieldwork:${{ needs.extract-vars.outputs.app_version }}-ci"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@main
needs: [extract-vars]
with:
context: .
build_target: prod
image_tags: |
"ghcr.io/hotosm/osm-fieldwork:${{ needs.extract-vars.outputs.app_version }}"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ COPY pyproject.toml pdm.lock /opt/python/
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir pdm==2.6.1
RUN pdm export --prod > requirements.txt \
&& pdm export -G debug -G test \
&& pdm export -G debug -G test -G docs \
--no-default > requirements-ci.txt


Expand Down
4 changes: 2 additions & 2 deletions osm_fieldwork/make_data_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MakeExtract(object):

def __init__(
self,
uri: str,
dburi: str,
config: str,
xlsfile: str,
):
Expand All @@ -76,7 +76,7 @@ def __init__(
Returns:
(MakeExtract): An instance of this object
"""
self.db = PostgresClient(uri, f"{rootdir}/data_models/{config}")
self.db = PostgresClient(dburi, f"{rootdir}/data_models/{config}")

# Read in the XLSFile
if "/" in xlsfile:
Expand Down
11 changes: 8 additions & 3 deletions osm_fieldwork/odk_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,21 @@
from cpuinfo import get_cpu_info
from geojson import Point
from haversine import Unit, haversine
from osm_rawdata.postgres import PostgresClient
from shapely.geometry import mapping, shape
from thefuzz import fuzz

from osm_fieldwork.convert import escape
from osm_fieldwork.make_data_extract import PostgresClient, uriParser
from osm_fieldwork.osmfile import OsmFile

# Instantiate logger
log = logging.getLogger(__name__)

# Find the other files for this project
import osm_fieldwork as of

rootdir = of.__path__[0]

# The number of threads is based on the CPU cores
info = get_cpu_info()
cores = info["count"]
Expand Down Expand Up @@ -67,11 +72,11 @@ def __init__(
# PG: is the same prefix as ogr2ogr
# "[user[:password]@][netloc][:port][/dbname]"
if source[0:3] == "PG:":
uri = uriParser(source[3:])
uri = source[3:]
# self.source = "underpass" is not support yet
# Each thread needs it's own connection to postgres to avoid problems.
for _thread in range(0, cores + 1):
db = PostgresClient(dbhost=uri["dbhost"], dbname=uri["dbname"], dbuser=uri["dbuser"], dbpass=uri["dbpass"])
db = PostgresClient(uri, f"{rootdir}/data_models/{config}")
self.postgres.append(db)
if boundary:
self.clip(boundary, db)
Expand Down
104 changes: 0 additions & 104 deletions tests/test_uriparser.py

This file was deleted.

0 comments on commit 967799b

Please sign in to comment.