From ded2f6975f19861d6acc258d66a6922a772cbd09 Mon Sep 17 00:00:00 2001 From: Zach Smith Date: Mon, 17 Apr 2023 11:18:26 +0200 Subject: [PATCH] Fixed assignment of NNODES in the run_croco.bash file, and testing conditional assignment in the actions workflow yml (#33) --- .github/workflows/run_algoa-bay-forecast.yml | 9 +++++---- .vscode/settings.json | 3 +++ models/algoa-bay-forecast/README.md | 1 + models/algoa-bay-forecast/croco.Dockerfile | 3 --- models/algoa-bay-forecast/croco/run-model/run_croco.bash | 6 +++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run_algoa-bay-forecast.yml b/.github/workflows/run_algoa-bay-forecast.yml index e5832e66..dcdcdc49 100644 --- a/.github/workflows/run_algoa-bay-forecast.yml +++ b/.github/workflows/run_algoa-bay-forecast.yml @@ -195,6 +195,7 @@ jobs: WORKDIR: ${{ needs.workdir.outputs.WORKDIR }} MODEL_RUN_DATE: ${{ needs.envs.outputs.MODEL_RUN_DATE }} SHA: sha-${{ github.sha }} + BRANCH_REF: ${{ needs.envs.outputs.BRANCH_REF }} steps: - name: Source ~/.bashrc (for NVM - required for non-interactive shells) continue-on-error: true # Maybe Node.js exists anyway @@ -205,8 +206,8 @@ jobs: uses: nick-fields/retry@master with: timeout_minutes: 30 # Script is considered failed if this limit is reached - retry_wait_seconds: 10 # Wait 10 minutes and try again - max_attempts: 10 + retry_wait_seconds: 300 # Wait 5 minutes and try again + max_attempts: ${{ if eq(env.BRANCH_REF, 'next') }}1{{ else }}5{{ endif }} retry_on: any warning_on_retry: true shell: bash @@ -230,8 +231,8 @@ jobs: uses: nick-fields/retry@master with: timeout_minutes: 30 # Script is considered failed if this limit is reached - retry_wait_seconds: 10 # Wait 10 minutes and try again - max_attempts: 10 + retry_wait_seconds: 300 # Wait 5 minutes and try again + max_attempts: ${{ if eq(env.BRANCH_REF, 'next') }}1{{ else }}5{{ endif }} retry_on: any warning_on_retry: true shell: bash diff --git a/.vscode/settings.json b/.vscode/settings.json index 0a6f0c4c..0d69bd57 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,7 @@ "arange", "arcgis", "asgeojson", + "AUTOTILING", "autovacuum", "backdata", "BASEMAP", @@ -31,6 +32,7 @@ "Cubehelix", "DFFE", "dirout", + "distrib", "Dockerized", "dtype", "Egagasini", @@ -78,6 +80,7 @@ "notistack", "numpy", "OISST", + "OPENMP", "Parens", "PGCONNECT", "pgdata", diff --git a/models/algoa-bay-forecast/README.md b/models/algoa-bay-forecast/README.md index 4cb08cd0..21a50d19 100644 --- a/models/algoa-bay-forecast/README.md +++ b/models/algoa-bay-forecast/README.md @@ -3,6 +3,7 @@ +- [Local development](#local-development) - [Deployment](#deployment) - [Server requirements](#server-requirements) - [Server configuration](#server-configuration) diff --git a/models/algoa-bay-forecast/croco.Dockerfile b/models/algoa-bay-forecast/croco.Dockerfile index 32da47f1..b98fec1b 100644 --- a/models/algoa-bay-forecast/croco.Dockerfile +++ b/models/algoa-bay-forecast/croco.Dockerfile @@ -7,9 +7,6 @@ ARG NP_XI=2 ENV NP_ETA=$NP_ETA ENV NP_XI=$NP_XI -RUN NNODES=$(( $NP_XI * $NP_ETA )) \ - && export NNODES=$NNODES - RUN apt-get update \ && apt-get install -y \ mpich \ diff --git a/models/algoa-bay-forecast/croco/run-model/run_croco.bash b/models/algoa-bay-forecast/croco/run-model/run_croco.bash index e8fe03a2..3193d35b 100755 --- a/models/algoa-bay-forecast/croco/run-model/run_croco.bash +++ b/models/algoa-bay-forecast/croco/run-model/run_croco.bash @@ -9,10 +9,10 @@ TIME_prev=$3 # i.e. 20220606 set as env variable called RESTART_FILE_DATE in .y HDAYS=5 # Fixed value in this context FDAYS=5 NH_AVG=1 # The temporal average of the output file in hours edited to save every hour -NH_AVGSURF=1 # The temporal average of the output file (only surface variables) in hours -NDAYS=$((HDAYS + FDAYS)) +NH_AVGSURF=1 # The temporal average of the output file (only surface variables) in hours +NDAYS=$((HDAYS + FDAYS)) INDIR=$(pwd) # where the croco_frcst.in file is stored, in the current setup it is in the same directory -MPI_NUM_PROCS=${NNODES:-4} # In the Docker environment, NNODES will always be set. The default is 4 when this file is used directly +MPI_NUM_PROCS=$(( ${NP_ETA:-2} * ${NP_XI:-2} )) EXEDIR=$(pwd) INPUTDIR=$RUNDIR/croco/forcing SCRATCHDIR=$RUNDIR/croco/scratch