Skip to content

Commit 1c7426d

Browse files
authored
Add y flag (#33)
* refactor: remove hardcoded geocoder API settings from update script * feat: add -y flag to import.sh to skip memory check * feat: add skip memory check option to import script
1 parent f81564b commit 1c7426d

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

scripts/import.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ usage() {
1717
echo " --data-dir PATH Directory to store processed data (default: ./)"
1818
echo " --memory SIZE JVM heap size (default: 16g)"
1919
echo " --threads NUM Maximum number of import threads (default: half of CPU cores)"
20+
echo " -y, --skip-mem-check Skip memory availability check and warning prompt"
2021
echo " -h, --help Show this help message"
2122
echo ""
2223
echo "Examples:"
@@ -40,6 +41,7 @@ THREADS=""
4041
PBF_FILE=""
4142

4243
# Parse arguments
44+
SKIP_MEM_CHECK=false
4345
while [[ $# -gt 0 ]]; do
4446
case $1 in
4547
--jar-file)
@@ -58,6 +60,10 @@ while [[ $# -gt 0 ]]; do
5860
THREADS="$2"
5961
shift 2
6062
;;
63+
-y|--skip-mem-check)
64+
SKIP_MEM_CHECK=true
65+
shift
66+
;;
6167
-h|--help)
6268
usage
6369
;;
@@ -129,7 +135,7 @@ REQUESTED_MEM_GB=$(echo "$MEMORY" | sed 's/[^0-9]//g')
129135
echo "System memory: ${AVAILABLE_MEM_GB}GB available"
130136
echo "Requested heap: $MEMORY"
131137

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

146154
# Build JVM arguments with memory management optimizations

scripts/update.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ IMPORT_THREADS="${IMPORT_THREADS:-10}"
2323
# --- Remote Machine Settings ---
2424
REMOTE_BASE_DIR="/opt/paikka/data"
2525

26-
# --- Geocoder API Settings ---
27-
GEOCODER_ADMIN_URL="http://localhost:8080/admin/refresh-db"
28-
GEOCODER_TEST_URL_BASE="http://localhost:8080/v1/reverse"
29-
3026
# Global variables that will be set by parse_args_and_configure or environment
3127
REMOTE_USER=""
3228
REMOTE_HOST=""
@@ -120,6 +116,7 @@ local_create_import_bundle() {
120116
--memory "$IMPORT_MEMORY" \
121117
--threads "$IMPORT_THREADS" \
122118
--data-dir "/import/" \
119+
--skip-mem-check \
123120
"/download/$PBF_FILTERED_FILE"
124121
}
125122

0 commit comments

Comments
 (0)