Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run_OQStandard.sh: Restore "oq engine --run" for Hazard calculation #56

Closed
wants to merge 2 commits into from

Conversation

anthonyfok
Copy link
Member

Also fix ShellCheck warnings.

@@ -147,61 +155,62 @@ echo "All initialization files exist - You're ready to go."
#exit 0
#fi

oq dbserver start || true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting dbserver manually here (instead of waiting till the first run of oq engine run to start dbserver) is a workaround to prevent tee in the first call of oq engine --run ... 2>&1 | tee ... from getting stuck.

I changed &> logfile to 2>&1 | tee logfile in various places throughout the script because I wanted to not only save the logs but also see OpenQuake output at the same time. Sorry, I neglected to document that in the commit log. 😅


if [[ $HAZFLAG == "1" ]]; then
echo "------------------------------------------------"
echo "RUNNING HAZARD CALCULATION"
echo "------------------------------------------------"
#oq engine --run ${JOBDIR}/s_Hazard_${NAME}.ini &> ./${OUTDIR}/s_Hazard_${NAME}.log;
oq engine --run "${JOBDIR}/s_Hazard_${NAME}.ini" 2>&1 | tee "./${OUTDIR}/s_Hazard_${NAME}.log"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original intent of this commit/PR was to uncomment this line so that oq engine is run for Hazard calculation so that the script would work for Jeremy and me.

My other changes to this file are mostly to make ShellCheck (the linter) happy, and probably should be in a separate commit, but I got lazy and didn't do that... sorry!

@@ -2,9 +2,13 @@
# ==========================================================================
# Script for running scenario calculations in the National Canada Risk Model
# ==========================================================================

set -exo pipefail
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I recall correctly, the motivation of setting set -o pipefail etc. is another consequence of me changing &> to 2>&1 | tee, as the subsequent pipe in | tee always succeed and wouldn't stop the script even if oq engine failed unless set -o pipefail etc. is set.

anthonyfok and others added 2 commits August 11, 2023 07:19
(renamed from generate_assets.yml)

Hope it does not run out of disk space again for our 22 scenarios!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant