New review fixes.

This commit is contained in:
Lev Dragunov 2016-04-27 20:05:08 +03:00
parent a42a1533a8
commit c116c87fc9
3 changed files with 27 additions and 17 deletions

View file

@ -79,6 +79,16 @@ for p1, p2 in tasks:
filtered.append((p1,p2))
tasks = filtered
if not len(tasks):
print("Towns not found. No job.")
exit(1)
try:
get_way_ids(tasks[0][0], tasks[0][1], sys.argv[2])
except:
print("Can't connect to remote server: {0}".format(sys.argv[2]))
exit(1)
qtasks = Queue()
capitals_list = set()
towns_list = set()

View file

@ -147,7 +147,6 @@ MERGE_INTERVAL=${MERGE_INTERVAL:-40}
NODE_STORAGE=${NODE_STORAGE:-${NS:-mem}}
ASYNC_PBF=${ASYNC_PBF-}
KEEP_INTDIR=${KEEP_INTDIR-1}
OSRM_URL=${OSRM_URL-}
# nproc is linux-only
if [ "$(uname -s)" == "Darwin" ]; then
CPUS="$(sysctl -n hw.ncpu)"
@ -302,19 +301,12 @@ fi
# This mode is started only after updating or processing a planet file
if [ "$MODE" == "roads" ]; then
if [ -z "$OSRM_URL" ]; then
log "OSRM_URL variable not set. Generate local world OSRM server."
putmode "Step RO: Generating whole world OSRM files for osrm-routed server."
bash "$ROUTING_SCRIPT" stop >> "$PLANET_LOG" 2>&1
bash "$ROUTING_SCRIPT" online >> "$PLANET_LOG" 2>&1
OSRM_URL="127.0.0.1:10012"
bash "$ROUTING_SCRIPT" server >> "$PLANET_LOG" 2>&1
if [ -z "${OSRM_URL-}" ]; then
log "OSRM_URL variable not set. World roads will not be calculated."
else
putmode "Step 2a: Generating road networks for the World map"
python "$ROADS_SCRIPT" "$INTDIR" "$OSRM_URL" >>"$LOG_PATH"/road_runner.log
fi
putmode "Step 2a: Generating road networks for the World map"
python "$ROADS_SCRIPT" "$INTDIR" "$OSRM_URL" >>"$LOG_PATH"/road_runner.log
MODE=inter
fi
@ -350,6 +342,11 @@ if [ -n "$OPT_ROUTING" -a -z "$NO_REGIONS" ]; then
fi
fi
if [ -n "$OPT_ONLINE_ROUTING" -a -z "$NO_REGIONS" ]; then
putmode "Step RO: Generating OSRM files for osrm-routed server."
bash "$ROUTING_SCRIPT" online >> "$PLANET_LOG" 2>&1
fi
if [ "$MODE" == "inter" ]; then
putmode "Step 3: Generating intermediate data for all MWMs"
# 1st pass, run in parallel - preprocess whole planet to speed up generation if all coastlines are correct

View file

@ -14,6 +14,9 @@ if [ $# -lt 1 ]; then
echo " $0 pbf"
echo " $0 prepare"
echo " $0 mwm"
echo " $0 online"
echo " $0 serve"
echo " $0 stop"
echo ''
exit 1
fi
@ -169,7 +172,7 @@ elif [ "$1" == "online" ]; then
echo "Failed to create $OSRM_FILE" >> "$LOG"
fi
elif [ "$1" == "server" ]; then
elif [ "$1" == "serve" ]; then
OSRM_PATH="${OSRM_PATH:-$OMIM_PATH/3party/osrm/osrm-backend}"
OSRM_BUILD_PATH="${OSRM_BUILD_PATH:-$OMIM_PATH/../osrm-backend-release}"
[ ! -x "$OSRM_BUILD_PATH/osrm-extract" ] && fail "Please compile OSRM binaries to $OSRM_BUILD_PATH"
@ -183,16 +186,16 @@ elif [ "$1" == "server" ]; then
RESTRICTIONS_FILE="$OSRM_FILE.restrictions"
LOG="$LOG_PATH/planet.log"
if [ -s "$OSRM_FILE" ]; then
echo "Starting: $OSRM_FILE" >> "$LOG"
echo "Starting: $OSRM_FILE"
"$OSRM_BUILD_PATH/osrm-routed" "$OSRM_FILE" --borders "$OMIM_PATH/data/" --port "$PORT" >> "$LOG" 2>&1 &
echo "Waiting until OSRM server starts:" >> "$LOG"
echo "Waiting until OSRM server starts:"
until $(curl --output /dev/null --silent --head --fail http://localhost:$PORT/mapsme); do
printf '.' >> "$LOG"
sleep 5
done
else
echo "Can't find OSRM file: $OSRM_FILE" >> "$LOG"
echo "Can't find OSRM file: $OSRM_FILE"
fi
else