diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 612a875fc72..b9f6267cf04 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -36,7 +36,7 @@ jobs: run: | sudo apt-get update -y sudo apt-get install -y valgrind - + - uses: actions/cache@v3 with: path: ~/.conan/ @@ -118,6 +118,18 @@ jobs: python-version: ${{ matrix.python-version }} test-type: ${{ matrix.test-type }} + test-slurm: + needs: [build-linux] + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + python-version: [ '3.8', '3.9', '3.10', '3.11' ] + uses: ./.github/workflows/test_ert_with_slurm.yml + with: + os: ${{ matrix.os }} + python-version: ${{ matrix.python-version }} + test-mac: needs: [build-mac] strategy: diff --git a/.github/workflows/test_ert_with_slurm.yml b/.github/workflows/test_ert_with_slurm.yml new file mode 100644 index 00000000000..3b24718c785 --- /dev/null +++ b/.github/workflows/test_ert_with_slurm.yml @@ -0,0 +1,76 @@ +on: + workflow_call: + inputs: + os: + type: string + python-version: + type: string +jobs: + test-poly-on-slurm: + name: Run ert tests + timeout-minutes: 20 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v4 + id: setup_python + with: + python-version: ${{ inputs.python-version }} + cache: "pip" + cache-dependency-path: | + setup.py + pyproject.toml + + - name: Get wheels + uses: actions/download-artifact@v3 + with: + name: ${{ inputs.os }} Python ${{ inputs.python-version }} wheel + + - name: Install wheel + run: | + find . -name "*.whl" -exec pip install "{}[dev]" \; + + - name: Install and setup slurm + run: | + set -e + + sudo apt install slurmd slurmctld -y + + cat < slurm.conf + ClusterName=localcluster + SlurmctldHost=localhost + SelectType=select/cons_res # Select nodes based on consumable resources + SelectTypeParameters=CR_Core # Cores are the consumable resource + ProctrackType=proctrack/linuxproc # Use /proc to track processes + PartitionName=LocalQ Nodes=ALL Default=YES MaxTime=INFINITE State=UP + EOF + + # Self-configure the node: + slurmd -C | grep NodeName >> slurm.conf + + cat slurm.conf + + sudo mv slurm.conf /etc/slurm/ + sudo systemctl start slurmd # The compute node slurm daemon + sudo systemctl start slurmctld # The slurm controller daemon + + # Show partition and node information configured: + sinfo + + - name: Verify slurm cluster works + # Timeout is set low to catch a misconfigured cluster where srun will hang. + timeout-minutes: 1 + run: | + srun env | grep SLURM + # Several SLURM_* env variables are defined only when run through slurm + + + - name: Test poly-example on slurm + run: | + set -e + + cd test-data/poly_example + echo "QUEUE_SYSTEM SLURM" >> poly.ert + time ert ensemble_experiment poly.ert