]> git.openstreetmap.org Git - nominatim.git/log
nominatim.git
3 years agomove import-data option to native python
Sarah Hoffmann [Wed, 24 Feb 2021 16:21:45 +0000 (17:21 +0100)]
move import-data option to native python

This adds a new dependecy to the Python psutil package.

3 years agointroduce custom object for cmdline arguments
Sarah Hoffmann [Wed, 24 Feb 2021 09:38:19 +0000 (10:38 +0100)]
introduce custom object for cmdline arguments

Allows to define special functions over the arguments.

Also splits CLI tests in two files as they have become too many.

3 years agoport database setup function to python
Sarah Hoffmann [Tue, 23 Feb 2021 21:50:23 +0000 (22:50 +0100)]
port database setup function to python

Hide the former PHP functions in a transition command until
they are removed.

3 years agouse psql for executing sql files
Sarah Hoffmann [Tue, 23 Feb 2021 18:05:51 +0000 (19:05 +0100)]
use psql for executing sql files

This allows to run larger files without needing to keep
them in memory.

3 years agoadd function to set up libpq environment
Sarah Hoffmann [Tue, 23 Feb 2021 13:11:11 +0000 (14:11 +0100)]
add function to set up libpq environment

Instead of parsing the DSN for each external libpq program we
are going to execute, provide a function that feeds them all
necessary parameters through the environment.

osm2pgsql is the first user.

3 years agoconvert connect() into a context manager
Sarah Hoffmann [Tue, 23 Feb 2021 09:11:21 +0000 (10:11 +0100)]
convert connect() into a context manager

3 years agoMerge pull request #2185 from lonvia/fix-deadlock-handling-for-psycopg27
Sarah Hoffmann [Thu, 25 Feb 2021 17:39:40 +0000 (18:39 +0100)]
Merge pull request #2185 from lonvia/fix-deadlock-handling-for-psycopg27

Improve deadlock detection for various versions of psycopg2

3 years agoimprove deadlock detection for various versions of psycopg2
Sarah Hoffmann [Thu, 25 Feb 2021 16:36:31 +0000 (17:36 +0100)]
improve deadlock detection for various versions of psycopg2

Psycopg2 has changed the kind of exception that is emitted on
deadlocks between versions 2.7 and 2.8. The code was already
trying to catch both kind of errors but because the
psycopg2.errors package is unknown in 2.7 and below, the
code would throw an exception on anything but a deadlock error.

This commit wraps the deadlock handling into a context manager
to avoid code duplication and uses module imports to detect if
the new error codes are available.

Also sets the required psycopg2 version to 2.7 or bigger as
versions below are difficult to test.

3 years agoMerge pull request #2182 from lonvia/change-error-for-details
Sarah Hoffmann [Tue, 23 Feb 2021 08:09:35 +0000 (09:09 +0100)]
Merge pull request #2182 from lonvia/change-error-for-details

Return 404 for details when no object is found in database

3 years agoreturn 404 for details when no bject is found in database
Sarah Hoffmann [Mon, 22 Feb 2021 15:28:29 +0000 (16:28 +0100)]
return 404 for details when no bject is found in database

Fixes #2157.

3 years agoMerge pull request #2181 from lonvia/port-more-tool-functions-to-python
Sarah Hoffmann [Mon, 22 Feb 2021 15:11:21 +0000 (16:11 +0100)]
Merge pull request #2181 from lonvia/port-more-tool-functions-to-python

Port more tool functions to python

3 years agoavoid os.environ as default valie
Sarah Hoffmann [Fri, 19 Feb 2021 18:29:57 +0000 (19:29 +0100)]
avoid os.environ as default valie

3 years agofix return code for check database run with 'not applicable'
Sarah Hoffmann [Fri, 19 Feb 2021 17:32:00 +0000 (18:32 +0100)]
fix return code for check database run with 'not applicable'

3 years agobdd tests: directly call python code for setup-website
Sarah Hoffmann [Fri, 19 Feb 2021 17:20:55 +0000 (18:20 +0100)]
bdd tests: directly call python code for setup-website

3 years agoport setup-website to python
Sarah Hoffmann [Fri, 19 Feb 2021 16:51:06 +0000 (17:51 +0100)]
port setup-website to python

3 years agoadd unit tests for new check_database code
Sarah Hoffmann [Thu, 18 Feb 2021 19:36:11 +0000 (20:36 +0100)]
add unit tests for new check_database code

3 years agoport check-database function to python
Sarah Hoffmann [Thu, 18 Feb 2021 16:32:30 +0000 (17:32 +0100)]
port check-database function to python

This change also adapts the hints to use the nominatim tool.
Slightly changed checks, so that they are just as effective on
a frozen database.

3 years agouse a frozen DB for API tests
Sarah Hoffmann [Wed, 17 Feb 2021 21:35:27 +0000 (22:35 +0100)]
use a frozen DB for API tests

This way we also test that dropping does the right thing.

3 years agoremove unused code
Sarah Hoffmann [Wed, 17 Feb 2021 21:25:23 +0000 (22:25 +0100)]
remove unused code

3 years agoport freeze function to python
Sarah Hoffmann [Wed, 17 Feb 2021 20:43:15 +0000 (21:43 +0100)]
port freeze function to python

3 years agoMerge pull request #2173 from lonvia/penality-for-housenumberless-places
Sarah Hoffmann [Wed, 17 Feb 2021 16:52:59 +0000 (17:52 +0100)]
Merge pull request #2173 from lonvia/penality-for-housenumberless-places

Increase penalty for places without housenumber

3 years agoMerge pull request #2174 from lonvia/disable-jit-for-osm2pgsql-again
Sarah Hoffmann [Tue, 16 Feb 2021 20:32:57 +0000 (21:32 +0100)]
Merge pull request #2174 from lonvia/disable-jit-for-osm2pgsql-again

Disable JIT and parallel execution for osm2pgsql updates again

3 years agodisable JIT and parallel execution for osm2pgsql updates again
Sarah Hoffmann [Tue, 16 Feb 2021 14:05:14 +0000 (15:05 +0100)]
disable JIT and parallel execution for osm2pgsql updates again

The gazetteer output doesn't disable these functions when
writing to the place table but the triggers may contain
operations that cause misplanning for the query planner.

3 years agoadd simple test for result splitting with multiple ranks
Sarah Hoffmann [Tue, 16 Feb 2021 16:59:12 +0000 (17:59 +0100)]
add simple test for result splitting with multiple ranks

3 years agoincrease penalty for places without housenumber
Sarah Hoffmann [Tue, 16 Feb 2021 16:47:06 +0000 (17:47 +0100)]
increase penalty for places without housenumber

Results where the housenumber was dropped are an unlikely result
when they refer to something other than a street. Therefore
increase their result rank so that other matches are tried first
before choosing them as a result.

Improves #2167.

3 years agoMerge pull request #2166 from mtmail/tiger-2020
Sarah Hoffmann [Tue, 16 Feb 2021 13:45:14 +0000 (14:45 +0100)]
Merge pull request #2166 from mtmail/tiger-2020

documentation: 2020 TIGER data got released

3 years agoMerge pull request #2171 from lonvia/update-vagrant-scripts-for-make-install
Sarah Hoffmann [Tue, 16 Feb 2021 13:42:38 +0000 (14:42 +0100)]
Merge pull request #2171 from lonvia/update-vagrant-scripts-for-make-install

Update vagrant scripts for make install

3 years agoswitch vagrant scripts to make install
Sarah Hoffmann [Tue, 16 Feb 2021 11:04:34 +0000 (12:04 +0100)]
switch vagrant scripts to make install

3 years agouse file copy on older cmake to install osm2pgsql
Sarah Hoffmann [Tue, 16 Feb 2021 10:06:14 +0000 (11:06 +0100)]
use file copy on older cmake to install osm2pgsql

Fixes #2170.

3 years agoignore failure to get replication date
Sarah Hoffmann [Sun, 14 Feb 2021 11:17:30 +0000 (12:17 +0100)]
ignore failure to get replication date

3 years agodocumentation: 2020 TIGER data got released
marc tobias [Wed, 3 Feb 2021 15:42:31 +0000 (16:42 +0100)]
documentation: 2020 TIGER data got released

3 years agoMerge pull request #2164 from lonvia/add-make-install
Sarah Hoffmann [Fri, 12 Feb 2021 09:32:26 +0000 (10:32 +0100)]
Merge pull request #2164 from lonvia/add-make-install

Make Nominatim installable

3 years agoalways return 0 for updates unless there is an error
Sarah Hoffmann [Thu, 11 Feb 2021 09:01:31 +0000 (10:01 +0100)]
always return 0 for updates unless there is an error

This is more in line with previous behavioru than returning
a status code when no updates are available.

3 years agodocs: adapt check-database command
Sarah Hoffmann [Wed, 10 Feb 2021 20:55:04 +0000 (21:55 +0100)]
docs: adapt check-database command

3 years agoactions: remove install directories before import
Sarah Hoffmann [Wed, 10 Feb 2021 15:35:50 +0000 (16:35 +0100)]
actions: remove install directories before import

This ensures that any dangling references to the build
or source directory are caught by the CI.

3 years agoneed test database for analysing cli test
Sarah Hoffmann [Wed, 10 Feb 2021 15:19:51 +0000 (16:19 +0100)]
need test database for analysing cli test

3 years agoactions: test import with installed version of Nominatim
Sarah Hoffmann [Wed, 10 Feb 2021 15:02:14 +0000 (16:02 +0100)]
actions: test import with installed version of Nominatim

3 years agoadd 'make install' to installation instructions
Sarah Hoffmann [Wed, 10 Feb 2021 10:15:21 +0000 (11:15 +0100)]
add 'make install' to installation instructions

3 years agotest for existance of country grid in cmake already
Sarah Hoffmann [Wed, 10 Feb 2021 09:40:36 +0000 (10:40 +0100)]
test for existance of country grid in cmake already

Given that the file potentially gets installed, it needs to be
present during build time already. Checking during the import
is too late.

3 years agomake installation targets conditional to what is built
Sarah Hoffmann [Wed, 10 Feb 2021 09:04:07 +0000 (10:04 +0100)]
make installation targets conditional to what is built

3 years agoadd make install target
Sarah Hoffmann [Tue, 9 Feb 2021 20:04:42 +0000 (21:04 +0100)]
add make install target

Installation includes PHP andPython libraries, settings, the basic
country data, the postgresql module and our custom version of
osm2pgsql. The latter is installed in our private library directory
so that it does not get in the way of a potentially installed
osm2pgsql from the distribution.

3 years agoadapt unit tests to new directory structure
Sarah Hoffmann [Tue, 9 Feb 2021 19:13:00 +0000 (20:13 +0100)]
adapt unit tests to new directory structure

3 years agouse DataDir constant for data only
Sarah Hoffmann [Tue, 9 Feb 2021 19:04:08 +0000 (20:04 +0100)]
use DataDir constant for data only

So far the data directory constant has pointed to the source
directory to be usable with different subdirectories. Now only
the data subdirectory itself is being used with the constant,
so point to the directory directly.

3 years agoforgot to replace one occurence of sql_dir
Sarah Hoffmann [Tue, 9 Feb 2021 18:32:05 +0000 (19:32 +0100)]
forgot to replace one occurence of sql_dir

3 years agoremove unused BINDIR constant
Sarah Hoffmann [Tue, 9 Feb 2021 18:30:31 +0000 (19:30 +0100)]
remove unused BINDIR constant

3 years agointroduce constant for configuration directory
Sarah Hoffmann [Tue, 9 Feb 2021 17:45:45 +0000 (18:45 +0100)]
introduce constant for configuration directory

This replaces {data_dir}/settings throughout the code, so that
the configuration may be placed somewhere else in the directory
structure (e.g. in /etc).

3 years agorename sql directory to lib-sql
Sarah Hoffmann [Tue, 9 Feb 2021 14:26:56 +0000 (15:26 +0100)]
rename sql directory to lib-sql

Also introduces a separate constant for the sql directory, so that
it can be put separately from the rest of the data if required.

3 years agorename lib to lib-php
Sarah Hoffmann [Tue, 9 Feb 2021 10:52:07 +0000 (11:52 +0100)]
rename lib to lib-php

3 years agoupdate osm2pgsql (disable install rule)
Sarah Hoffmann [Tue, 9 Feb 2021 08:48:50 +0000 (09:48 +0100)]
update osm2pgsql (disable install rule)

3 years agointegrate analyse of indexing into nominatim tool
Sarah Hoffmann [Mon, 8 Feb 2021 21:21:57 +0000 (22:21 +0100)]
integrate analyse of indexing into nominatim tool

3 years agoconsolidate warm and db-check into single admin command
Sarah Hoffmann [Mon, 8 Feb 2021 20:05:06 +0000 (21:05 +0100)]
consolidate warm and db-check into single admin command

3 years agosplit cli.py by subcommands
Sarah Hoffmann [Mon, 8 Feb 2021 16:23:05 +0000 (17:23 +0100)]
split cli.py by subcommands

Reduces file size below 1000 lines.

3 years agomove website into php library directory
Sarah Hoffmann [Mon, 8 Feb 2021 11:00:34 +0000 (12:00 +0100)]
move website into php library directory

3 years agomove postcode table setup to sql/
Sarah Hoffmann [Mon, 8 Feb 2021 10:48:45 +0000 (11:48 +0100)]
move postcode table setup to sql/

Also moves the call to the setup from the setup-db
step to the calculate-postcodes step. The tables also need
no longer be accessible by the webservice.

3 years agoremove unused SQL script
Sarah Hoffmann [Mon, 8 Feb 2021 10:28:24 +0000 (11:28 +0100)]
remove unused SQL script

3 years agofix off-by-one error in replication download
Sarah Hoffmann [Thu, 4 Feb 2021 16:04:04 +0000 (17:04 +0100)]
fix off-by-one error in replication download

3 years agoMerge pull request #2161 from lonvia/timeout-for-replication
Sarah Hoffmann [Thu, 4 Feb 2021 15:52:24 +0000 (16:52 +0100)]
Merge pull request #2161 from lonvia/timeout-for-replication

Reintroduce timeout for replication file download

3 years agoreintroduce timeout for replication file download
Sarah Hoffmann [Thu, 4 Feb 2021 10:47:11 +0000 (11:47 +0100)]
reintroduce timeout for replication file download

This ports the --socket-timeout parameter from
pyosmium-get-changes which ensures that the update
process eventually times out on hanging network connections.

3 years agoMerge pull request #2160 from lonvia/introduce-project-dir
Sarah Hoffmann [Thu, 4 Feb 2021 08:52:59 +0000 (09:52 +0100)]
Merge pull request #2160 from lonvia/introduce-project-dir

Officially introduce and recommend use of a project directory

3 years agoreplace make serve with nominatim serve command
Sarah Hoffmann [Wed, 3 Feb 2021 15:17:46 +0000 (16:17 +0100)]
replace make serve with nominatim serve command

With the website directory now tied to the project directory instead
of the build directory, it is no longer possible to use make for
running the web server.

3 years agoadd migration info for status table
Sarah Hoffmann [Wed, 3 Feb 2021 13:13:09 +0000 (14:13 +0100)]
add migration info for status table

3 years agoRevert "increase splitting for large geometries"
Sarah Hoffmann [Wed, 3 Feb 2021 09:23:38 +0000 (10:23 +0100)]
Revert "increase splitting for large geometries"

This reverts commit 559fe513fa8ffa3a5bc3a7d07c252a872614c073.

Increasing the splitting results in geometries where with rounding
issues at the split points, so that contain operations do not
work as expected anymore.

Fixes #2137.

3 years agoadapt quick start instructions in README to project dir
Sarah Hoffmann [Wed, 3 Feb 2021 09:17:22 +0000 (10:17 +0100)]
adapt quick start instructions in README to project dir

3 years agodo not overwrite custom set module paths
Sarah Hoffmann [Tue, 2 Feb 2021 16:33:41 +0000 (17:33 +0100)]
do not overwrite custom set module paths

Given that the module is now copied to the project directory
when no module path is set, we need the information that the
module path is empty. Therefore hand in the default module path
in a separate variable.

3 years agoprint project directory before running any command
Sarah Hoffmann [Tue, 2 Feb 2021 10:19:31 +0000 (11:19 +0100)]
print project directory before running any command

3 years agomake phpcs happy
Sarah Hoffmann [Tue, 2 Feb 2021 10:15:56 +0000 (11:15 +0100)]
make phpcs happy

3 years agoactions: switch to using separate project dir
Sarah Hoffmann [Tue, 2 Feb 2021 10:03:09 +0000 (11:03 +0100)]
actions: switch to using separate project dir

Also fixes reverse-only import which not run at all.

3 years agodocs: add hint about putting the nominatim tool into the PATH
Sarah Hoffmann [Tue, 2 Feb 2021 09:51:03 +0000 (10:51 +0100)]
docs: add hint about putting the nominatim tool into the PATH

3 years agocopy database module on install
Sarah Hoffmann [Tue, 2 Feb 2021 09:20:05 +0000 (10:20 +0100)]
copy database module on install

When no explicity database module is configured, then the
module is now copied into the project directory and used from
there. This means that Nominatim can be updated to a new
version of the module while existing installation keep their
version of normalisation.

3 years agohand in absolute path to nominatim tool to php scripts
Sarah Hoffmann [Mon, 1 Feb 2021 16:44:13 +0000 (17:44 +0100)]
hand in absolute path to nominatim tool to php scripts

3 years agorefer to new nominatim tool in configuration comments
Sarah Hoffmann [Mon, 1 Feb 2021 16:27:29 +0000 (17:27 +0100)]
refer to new nominatim tool in configuration comments

3 years agochange the default location for external data to project dir
Sarah Hoffmann [Mon, 1 Feb 2021 16:27:01 +0000 (17:27 +0100)]
change the default location for external data to project dir

3 years agoactions: revert to reletive paths for caching
Sarah Hoffmann [Tue, 2 Feb 2021 09:37:18 +0000 (10:37 +0100)]
actions: revert to reletive paths for caching

3 years agoactions: remove setting custom .env
Sarah Hoffmann [Tue, 2 Feb 2021 09:35:30 +0000 (10:35 +0100)]
actions: remove setting custom .env

It only set the pyosmium-get-changes binary which is no longer
needed.

3 years agoremove pyosmium-get-changes detection from cmake
Sarah Hoffmann [Tue, 2 Feb 2021 09:33:15 +0000 (10:33 +0100)]
remove pyosmium-get-changes detection from cmake

pyosmium-get-changes is not longer used.

3 years agoMerge pull request #2155 from lonvia/port-regresh-to-python
Sarah Hoffmann [Mon, 1 Feb 2021 10:50:05 +0000 (11:50 +0100)]
Merge pull request #2155 from lonvia/port-regresh-to-python

Port replication and part of the refrsh function to native Python

3 years agoprint nice summary after updates
Sarah Hoffmann [Sat, 30 Jan 2021 19:32:46 +0000 (20:32 +0100)]
print nice summary after updates

3 years agofix linting issues
Sarah Hoffmann [Sat, 30 Jan 2021 15:42:25 +0000 (16:42 +0100)]
fix linting issues

3 years agodisable warning about non-toplevel import
Sarah Hoffmann [Sat, 30 Jan 2021 15:27:02 +0000 (16:27 +0100)]
disable warning about non-toplevel import

They are needed here so nominatim can be run when osmium
is not installed. Everything except replication will work fine.

3 years agointroduce custom UsageError
Sarah Hoffmann [Sat, 30 Jan 2021 15:20:10 +0000 (16:20 +0100)]
introduce custom UsageError

This is a exception to be thrown when the error occures because
of bad user data. We don't want to print a full stack trace in
these cases but just tell the user what went wrong.

3 years agoremove setting for PYOSMIUM_BINARY
Sarah Hoffmann [Sat, 30 Jan 2021 14:55:04 +0000 (15:55 +0100)]
remove setting for PYOSMIUM_BINARY

pyosmium is now called as a library from the python code,
so that pyosmium-get-changes is no longer needed.

3 years agowhitelist pyosmium for pylint
Sarah Hoffmann [Sat, 30 Jan 2021 14:52:49 +0000 (15:52 +0100)]
whitelist pyosmium for pylint

3 years agoport replication update function to python
Sarah Hoffmann [Sat, 30 Jan 2021 14:50:34 +0000 (15:50 +0100)]
port replication update function to python

3 years agoport check-for-update function to python
Sarah Hoffmann [Thu, 28 Jan 2021 13:34:17 +0000 (14:34 +0100)]
port check-for-update function to python

3 years agoMerge pull request #2153 from rizkyarlin/patch-1
Sarah Hoffmann [Thu, 28 Jan 2021 08:06:33 +0000 (09:06 +0100)]
Merge pull request #2153 from rizkyarlin/patch-1

fix indentation

3 years agofix indentation
Muh. Rizky Eka Arlin [Thu, 28 Jan 2021 06:21:54 +0000 (14:21 +0800)]
fix indentation

3 years agoport replication initialisation to Python
Sarah Hoffmann [Tue, 26 Jan 2021 21:45:24 +0000 (22:45 +0100)]
port replication initialisation to Python

3 years agoconvert functon creation to python
Sarah Hoffmann [Sun, 24 Jan 2021 13:35:35 +0000 (14:35 +0100)]
convert functon creation to python

The new functions always creates normal and partitioned functions.
Also adds specialised connection and cursor classes for adding
frequently used helper functions.

3 years agoport address level computation to Python
Sarah Hoffmann [Sat, 23 Jan 2021 16:25:14 +0000 (17:25 +0100)]
port address level computation to Python

Also adds simple tests for correct table creation.

3 years agomove update code for postcode and word count to Python
Sarah Hoffmann [Fri, 22 Jan 2021 22:25:37 +0000 (23:25 +0100)]
move update code for postcode and word count to Python

Adds also tests for the new function to execute a SQL script.

3 years agocli: import python modules for commands on demand
Sarah Hoffmann [Thu, 21 Jan 2021 09:19:38 +0000 (10:19 +0100)]
cli: import python modules for commands on demand

Given that only one command will be executed in the end, it is
not necessary to import what amounts to the whole library. This
becomes in particular important for update functions that have
a dependency on pyosmium. The dependency can remain optional for
people not using updates.

3 years agoremove API comparison util
Sarah Hoffmann [Tue, 26 Jan 2021 21:46:35 +0000 (22:46 +0100)]
remove API comparison util

This is outdated and unmaintained. There are tools out there
which can do this better. Try, for example
https://github.com/radarlabs/api-diff

3 years agoMerge pull request #2147 from lonvia/tests-for-python-code
Sarah Hoffmann [Thu, 21 Jan 2021 09:07:50 +0000 (10:07 +0100)]
Merge pull request #2147 from lonvia/tests-for-python-code

Add basic set of tests for Python code

3 years agocli indexer tests need a fake database
Sarah Hoffmann [Wed, 20 Jan 2021 19:24:39 +0000 (20:24 +0100)]
cli indexer tests need a fake database

The Indexer constructor opens a connection to the given database.

3 years agoadd more tests for CLI parameter parser
Sarah Hoffmann [Wed, 20 Jan 2021 15:43:06 +0000 (16:43 +0100)]
add more tests for CLI parameter parser

3 years agoadd tests for indexer
Sarah Hoffmann [Wed, 20 Jan 2021 14:42:58 +0000 (15:42 +0100)]
add tests for indexer

3 years agoadd simple tests for CLI parsing
Sarah Hoffmann [Wed, 20 Jan 2021 08:53:47 +0000 (09:53 +0100)]
add simple tests for CLI parsing

3 years agooptionally hand in command line arguments to CLI functions
Sarah Hoffmann [Wed, 20 Jan 2021 08:04:04 +0000 (09:04 +0100)]
optionally hand in command line arguments to CLI functions

Allows easier testing.

3 years agouse pytest mocking functions for manipulating os.environ
Sarah Hoffmann [Wed, 20 Jan 2021 08:03:09 +0000 (09:03 +0100)]
use pytest mocking functions for manipulating os.environ

3 years agoadd tests for Python exec_utils
Sarah Hoffmann [Wed, 20 Jan 2021 08:02:45 +0000 (09:02 +0100)]
add tests for Python exec_utils