Skip to content
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
10 changes: 9 additions & 1 deletion scripts/import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ usage() {
echo " --data-dir PATH Directory to store processed data (default: ./)"
echo " --memory SIZE JVM heap size (default: 16g)"
echo " --threads NUM Maximum number of import threads (default: half of CPU cores)"
echo " -y, --skip-mem-check Skip memory availability check and warning prompt"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
Expand All @@ -40,6 +41,7 @@ THREADS=""
PBF_FILE=""

# Parse arguments
SKIP_MEM_CHECK=false
while [[ $# -gt 0 ]]; do
case $1 in
--jar-file)
Expand All @@ -58,6 +60,10 @@ while [[ $# -gt 0 ]]; do
THREADS="$2"
shift 2
;;
-y|--skip-mem-check)
SKIP_MEM_CHECK=true
shift
;;
-h|--help)
usage
;;
Expand Down Expand Up @@ -129,7 +135,7 @@ REQUESTED_MEM_GB=$(echo "$MEMORY" | sed 's/[^0-9]//g')
echo "System memory: ${AVAILABLE_MEM_GB}GB available"
echo "Requested heap: $MEMORY"

if [ "$REQUESTED_MEM_GB" -gt "$AVAILABLE_MEM_GB" ]; then
if [ "$SKIP_MEM_CHECK" = false ] && [ "$REQUESTED_MEM_GB" -gt "$AVAILABLE_MEM_GB" ]; then
echo ""
echo "⚠️ WARNING: Requested heap size ($MEMORY) exceeds available memory (${AVAILABLE_MEM_GB}GB)"
echo " This may cause the process to be killed by the OOM killer."
Expand All @@ -141,6 +147,8 @@ if [ "$REQUESTED_MEM_GB" -gt "$AVAILABLE_MEM_GB" ]; then
echo "Import cancelled."
exit 1
fi
elif [ "$SKIP_MEM_CHECK" = true ]; then
echo "Skipping memory check (--skip-mem-check flag used)"
fi

# Build JVM arguments with memory management optimizations
Expand Down
5 changes: 1 addition & 4 deletions scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ IMPORT_THREADS="${IMPORT_THREADS:-10}"
# --- Remote Machine Settings ---
REMOTE_BASE_DIR="/opt/paikka/data"

# --- Geocoder API Settings ---
GEOCODER_ADMIN_URL="http://localhost:8080/admin/refresh-db"
GEOCODER_TEST_URL_BASE="http://localhost:8080/v1/reverse"

# Global variables that will be set by parse_args_and_configure or environment
REMOTE_USER=""
REMOTE_HOST=""
Expand Down Expand Up @@ -120,6 +116,7 @@ local_create_import_bundle() {
--memory "$IMPORT_MEMORY" \
--threads "$IMPORT_THREADS" \
--data-dir "/import/" \
--skip-mem-check \
"/download/$PBF_FILTERED_FILE"
}

Expand Down
Loading