Skip to content

Commit 8c7b9d1

Browse files
robertbartelchristophertubbs
authored andcommitted
Fix ngen entrypoint script for gpkg hydrofabric.
Fixing to properly support geopackage hydrofabric dataset type in commands to execute ngen if that is what is provided; also adding creation of a symlink to output dataset in fixed location for routing.
1 parent eb2b3c9 commit 8c7b9d1

File tree

2 files changed

+32
-14
lines changed

2 files changed

+32
-14
lines changed

docker/main/ngen/funcs.sh

+28-14
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,24 @@ exec_main_worker_ngen_run()
9292

9393
# Execute the model on the linked data
9494
echo "$(print_date) Executing mpirun command for ngen on ${MPI_NODE_COUNT} workers"
95-
${MPI_RUN:?} -f "${MPI_HOSTS_FILE}" -n ${MPI_NODE_COUNT} \
96-
${NGEN_EXECUTABLE:?} ${HYDROFABRIC_DATASET_DIR}/catchment_data.geojson "" \
97-
${HYDROFABRIC_DATASET_DIR}/nexus_data.geojson "" \
98-
${CONFIG_DATASET_DIR}/realization_config.json \
99-
${PARTITION_DATASET_DIR}/partition_config.json \
100-
--subdivided-hydrofabric
101-
102-
#Capture the return value to use as service exit code
103-
NGEN_RETURN=$?
95+
if [ -e ${HYDROFABRIC_DATASET_DIR}/catchment_data.geojson ]; then
96+
${MPI_RUN:?} -f "${MPI_HOSTS_FILE}" -n ${MPI_NODE_COUNT} \
97+
${NGEN_EXECUTABLE:?} ${HYDROFABRIC_DATASET_DIR}/catchment_data.geojson "" \
98+
${HYDROFABRIC_DATASET_DIR}/nexus_data.geojson "" \
99+
${CONFIG_DATASET_DIR}/realization_config.json \
100+
${PARTITION_DATASET_DIR}/partition_config.json \
101+
--subdivided-hydrofabric
102+
#Capture the return value to use as service exit code
103+
NGEN_RETURN=$?
104+
else
105+
_GPKG_FILE="$(ls ${HYDROFABRIC_DATASET_DIR}/*.gpkg)"
106+
${MPI_RUN:?} -f "${MPI_HOSTS_FILE}" -n ${MPI_NODE_COUNT} \
107+
${NGEN_EXECUTABLE:?} ${_GPKG_FILE} "" ${_GPKG_FILE} "" \
108+
${CONFIG_DATASET_DIR}/realization_config.json \
109+
${PARTITION_DATASET_DIR}/partition_config.json
110+
#Capture the return value to use as service exit code
111+
NGEN_RETURN=$?
112+
fi
104113

105114
echo "$(print_date) ngen mpirun command finished with return value: ${NGEN_RETURN}"
106115

@@ -114,12 +123,17 @@ exec_serial_ngen_run()
114123

115124
# Execute the model on the linked data
116125
echo "$(print_date) Executing serial build of ngen"
117-
${NGEN_SERIAL_EXECUTABLE:?} ${HYDROFABRIC_DATASET_DIR}/catchment_data.geojson "" \
118-
${HYDROFABRIC_DATASET_DIR}/nexus_data.geojson "" \
119-
${CONFIG_DATASET_DIR}/realization_config.json
126+
if [ -e ${HYDROFABRIC_DATASET_DIR}/catchment_data.geojson ]; then
127+
${NGEN_SERIAL_EXECUTABLE:?} ${HYDROFABRIC_DATASET_DIR}/catchment_data.geojson "" \
128+
${HYDROFABRIC_DATASET_DIR}/nexus_data.geojson "" \
129+
${CONFIG_DATASET_DIR}/realization_config.json
120130

121-
#Capture the return value to use as service exit code
122-
NGEN_RETURN=$?
131+
#Capture the return value to use as service exit code
132+
NGEN_RETURN=$?
133+
else
134+
_GPKG_FILE="$(ls ${HYDROFABRIC_DATASET_DIR}/*.gpkg)"
135+
${NGEN_SERIAL_EXECUTABLE:?} ${_GPKG_FILE} "" ${_GPKG_FILE} "" ${CONFIG_DATASET_DIR}/realization_config.json
136+
fi
123137

124138
echo "$(print_date) serial ngen command finished with return value: ${NGEN_RETURN}"
125139

docker/main/ngen/ngen_entrypoint.sh

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ init_ngen_executable_paths
4848

4949
# Move to the output dataset mounted directory
5050
cd ${OUTPUT_DATASET_DIR:?Output dataset directory not defined}
51+
#Needed for routing
52+
if [ ! -e /dmod/dataset/experiment_output ]; then
53+
ln -s $(pwd) /dmod/dataset/experiment_output
54+
fi
5155

5256
# We can allow worker index to not be supplied when executing serially
5357
if [ "${WORKER_INDEX:-0}" = "0" ]; then

0 commit comments

Comments
 (0)