Skip to content

operational opendrift #37

operational opendrift

operational opendrift #37

Workflow file for this run

name: operational opendrift
on:
workflow_dispatch:
inputs:
model_type:
description: 'The kind of model to run'
required: true
default: 'oceandrift'
type: choice
options:
- oceandrift
- oil
- leeway
run_model:
description: 'run the model?'
required: true
type: boolean
default: true
do_post:
description: 'do the postprocessing?'
required: true
type: boolean
default: true
extents:
description: 'spatial extent of the gridded output and plot, in format lon0,lon1,lat0,lat1. If None, then this is dynamically determined from the geographic extent of the particles'
required: true
default: None
type: string
dx_m:
description: 'grid size (m) used to grid particle output. If None, If None, then a 50 x 50 regular grid is generated'
required: true
default: None
type: string
# Many of the env variables reference the current branch,
# which is set dynamically in the branch-ref job below
# So the env variables are mostly set in the envs job below the branch-ref job
env:
REGISTRY: ghcr.io
jobs:
# Dynamically set the branch ref to the currently executing branch
branch-ref:
runs-on: ubuntu-latest
outputs:
value: ${{ steps.BRANCH_REF.outputs.value }}
steps:
- name: Set the BRANCH_REF
id: BRANCH_REF
run: |
echo "value=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
# set some environment variables
envs:
needs: [branch-ref]
runs-on: ubuntu-latest
outputs:
BRANCH_REF: ${{ needs.branch-ref.outputs.value }}
RUN_DATE: ${{ steps.run_date.outputs.value }}
CONFIG_NAME: ${{ steps.config_name.outputs.value }}
steps:
- name: Check out source code so have access to the files in the repo
uses: actions/checkout@main
with:
ref: ${{ needs.branch-ref.outputs.value }}
- name: configuration name
id: config_name
run: |
# Use grep to find the line where the variable is defined
line=$(grep -m 1 -w config_name configs/config_${{ github.event.inputs.model_type }}.py)
# Use awk to extract the value of the variable from the line (thanks chatgpt)
echo "value=$(echo "$line" | awk -F "=" '{print $2}' | sed -e 's/^[[:space:]]*//')" >> $GITHUB_OUTPUT
- name: run date
id: run_date
run: |
# Use grep to find the line where the variable is defined
line=$(grep -m 1 -w run_date configs/config_${{ github.event.inputs.model_type }}.py)
# Use awk to extract the value of the variable from the line (thanks chatgpt)
echo "value=$(echo "$line" | awk -F "=" '{print $2}' | sed -e 's/^[[:space:]]*//')" >> $GITHUB_OUTPUT
build_image:
uses: ./.github/workflows/build_image.yml # Path to your reusable workflow
# I thought about using the matrix strategy to run models in parallel, but if one job fails, then they all get called off so it's better run them as separate jobs, which still get run in parallel
run_GFS_MERCATOR:
needs: [envs,build_image]
uses: ./.github/workflows/run_model.yml # Path to your reusable workflow
with:
MODEL_TYPE: ${{ github.event.inputs.model_type }}
BRANCH_REF: ${{ needs.envs.outputs.BRANCH_REF }}
CONFIG_NAME: ${{ needs.envs.outputs.CONFIG_NAME }}
RUN_DATE: ${{ needs.envs.outputs.RUN_DATE }}
RUNNER_NAME: mims1
WIND: GFS
OGCM: MERCATOR
RUN_MODEL: ${{ github.event.inputs.run_model }}
DO_POST: ${{ github.event.inputs.do_post }}
EXTENTS: ${{ github.event.inputs.extents }}
DX_M: ${{ github.event.inputs.dx_m }}
run_SAWS_MERCATOR:
needs: [envs,build_image]
uses: ./.github/workflows/run_model.yml # Path to your reusable workflow
with:
MODEL_TYPE: ${{ github.event.inputs.model_type }}
BRANCH_REF: ${{ needs.envs.outputs.BRANCH_REF }}
CONFIG_NAME: ${{ needs.envs.outputs.CONFIG_NAME }}
RUN_DATE: ${{ needs.envs.outputs.RUN_DATE }}
RUNNER_NAME: mims1
WIND: SAWS
OGCM: MERCATOR
RUN_MODEL: ${{ github.event.inputs.run_model }}
DO_POST: ${{ github.event.inputs.do_post }}
EXTENTS: ${{ github.event.inputs.extents }}
DX_M: ${{ github.event.inputs.dx_m }}
# get some combined output from runs with different forcings
# maybe we need a check to see if more than 1 run was actually successful?
combine_output:
needs: [envs,run_SAWS_MERCATOR,run_GFS_MERCATOR]
if: ${{ always() && ${{ github.event.inputs.do_post }} == 'true' }}

Check failure on line 123 in .github/workflows/run_ops.yml

View workflow run for this annotation

GitHub Actions / operational opendrift

Invalid workflow file

The workflow is not valid. .github/workflows/run_ops.yml (Line: 123, Col: 9): Unexpected symbol: '${{'. Located at position 13 within expression: always() && ${{ github.event.inputs.do_post
uses: ./.github/workflows/combine_output.yml # Path to your reusable workflow
with:
MODEL_TYPE: ${{ github.event.inputs.model_type }}
BRANCH_REF: ${{ needs.envs.outputs.BRANCH_REF }}
CONFIG_NAME: ${{ needs.envs.outputs.CONFIG_NAME }}
RUN_DATE: ${{ needs.envs.outputs.RUN_DATE }}
RUNNER_NAME: mims1
EXTENTS: ${{ github.event.inputs.extents }}