]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/clicmd/add_data.py
always state encoding when opening files in text mode
[nominatim.git] / nominatim / clicmd / add_data.py
index 95e95b0a7da94a350ce32d2a0f6c62bb77817550..013d5310eac2de059165b3784efabf74cdcd6080 100644 (file)
@@ -1,8 +1,16 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# This file is part of Nominatim. (https://nominatim.org)
+#
+# Copyright (C) 2022 by the Nominatim developer community.
+# For a full list of authors see the git log.
 """
 Implementation of the 'add-data' subcommand.
 """
 import logging
 
+import psutil
+
 # Do not repeat documentation of subcommand classes.
 # pylint: disable=C0111
 # Using non-top-level imports to avoid eventually unused imports.
@@ -59,7 +67,8 @@ class UpdateAddData:
         if args.tiger_data:
             tokenizer = tokenizer_factory.get_tokenizer_for_db(args.config)
             return tiger_data.add_tiger_data(args.tiger_data,
-                                             args.config, args.threads or 1,
+                                             args.config,
+                                             args.threads or psutil.cpu_count()  or 1,
                                              tokenizer)
 
         osm2pgsql_params = args.osm2pgsql_options(default_cache=1000, default_threads=1)