Skip to content

Commit

Permalink
add TEEHR test
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanLaserGit committed Jan 28, 2025
1 parent 7b24908 commit 17ac5fa
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test_datastream_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,10 @@ jobs:
sudo rm -rf $(pwd)/data/datastream_test
./scripts/ngen-datastream -s DAILY -C NWM_ANALYSIS_ASSIM_EXTEND -e $(date -d '-2 day' '+%Y%m%d0000') -d $(pwd)/data/datastream_test -g $(pwd)/palisade.gpkg -R $(pwd)/configs/ngen/realization_sloth_nom_cfe_pet.json
- name: TEEHR integration test
if: always()
run: |
sudo rm -rf $(pwd)/data/datastream_test
./scripts/ngen-datastream -s DAILY -C NWM_V3_SHORT_RANGE -d $(pwd)/data/datastream_test -g $(pwd)/palisade.gpkg -R $(pwd)/configs/ngen/realization_sloth_nom_cfe_pet.json -E True
4 changes: 3 additions & 1 deletion docs/DATASTREAM_OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ or run with cli args
-o, --S3_PREFIX <File prefix within s3 bucket>
-n, --NPROCS <Process limit>
-y, --DRYRUN <True to skip calculations>
-E, --EVAL <True to run TEEHR evaluation service>
```

### Explanation of cli args (or variables in defined in `CONF_FILE`)
Expand All @@ -46,4 +47,5 @@ or run with cli args
| S3_PREFIX | `-o` | Path within S3 bucket to write to |
| DRYRUN | `-y` | Set to "True" to skip all compute steps. |
| NPROCS | `-n` | Maximum number of processes to use in any step of `ngen-datastream`. Defaults to `nprocs - 2` | |
| CONF_FILE | `-c` | Store CLI args as env variables in a file. | |
| CONF_FILE | `-c` | Store CLI args as env variables in a file. | |
| EVAL | `-E` | Set to "True" to run the TEEHR automated evaluation service on NextGen outputs. | |
26 changes: 20 additions & 6 deletions scripts/ngen-datastream
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ usage() {
echo " -o, --S3_PREFIX <File prefix within s3 bucket> "
echo " -n, --NPROCS <Process limit> "
echo " -y, --DRYRUN <True to skip calculations> "
echo " -E, --EVAL <True to run TEEHR evaluation service> "
exit 1
}

Expand All @@ -130,6 +131,7 @@ S3_BUCKET=""
S3_PREFIX=""
NPROCS=4
DRYRUN="False"
DO_TEEHR="False"

PKL_FILE=""
DATASTREAM_WEIGHTS=""
Expand Down Expand Up @@ -180,6 +182,7 @@ while [ "$#" -gt 0 ]; do
-o|--S3_PREFIX) S3_PREFIX="$2"; shift 2;;
-n|--NPROCS) NPROCS="$2"; shift 2;;
-y|--DRYRUN) DRYRUN="$2"; shift 2;;
-E|--EVAL) EVAL="$2"; shift 2;;
*) usage;;
esac
done
Expand Down Expand Up @@ -573,18 +576,29 @@ NGENRUN_TAR="${DATA_DIR%/}/$TAR_NAME"
tar -cf - $NGEN_RUN | pigz > $NGENRUN_TAR
log_time "TAR_END" $DATASTREAM_PROFILING $S3_OUT

echo "DOCKER HASHES"
echo "DATASTREAM " $DS_HASH
echo "FORCINGPROCESSOR " $FP_HASH
echo "NGIAB " $NGIAB_HASH
echo "MERKDIR " $MERK_HASH
echo "STREAM SCRIPT " $STREAM_HASH
if [ "$EVAL" == "True" ]; then
log_time "EVAL_START" $DATASTREAM_PROFILING $S3_OUT
TEEHR_DOCKER=awiciroh/ngiab-teehr
TEEHR_TAG="latest"
docker run -v "$DATA_DIR:/app/data" "$TEEHR_DOCKER:$TEEHR_TAG"
TEEHR_HASH=$(docker inspect --format='{{json .Id}}' $(docker image ls "$TEEHR_DOCKER:$TEEHR_TAG" --format "{{.ID}}") | tr -d '"')
log_time "EVAL_END" $DATASTREAM_PROFILING $S3_OUT
fi

echo "sha256 hashes:"
echo "DATASTREAM DOCKER " $DS_HASH
echo "FORCINGPROCESSOR DOCKER " $FP_HASH
echo "NGIAB DOCKER " $NGIAB_HASH
echo "MERKDIR DOCKER " $MERK_HASH
echo "TEEHR DOCKER " $TEEHR_HASH
echo "STREAM SCRIPT " $STREAM_HASH

HASHES=$DATASTREAM_META/docker_hashes.txt
echo "DATASTREAM DOCKER: $DS_HASH" >> $HASHES
echo "FORCINGPROCESSOR DOCKER: $FP_HASH" >> $HASHES
echo "NGIAB DOCKER: $NGIAB_HASH" >> $HASHES
echo "MERKDIR DOCKER: $MERK_HASH" >> $HASHES
echo "TEEHR DOCKER: $TEEHR_HASH" >> $HASHES
echo "STREAM SCRIPT: $STREAM_HASH" >> $HASHES

log_time "DATASTREAM_END" $DATASTREAM_PROFILING $S3_OUT
Expand Down

0 comments on commit 17ac5fa

Please sign in to comment.