Skip to content

Adding the jplots from cutthrough_timeseries script to analysator plot module #501

Adding the jplots from cutthrough_timeseries script to analysator plot module

Adding the jplots from cutthrough_timeseries script to analysator plot module #501

# This workflow will install Python dependencies and analysator, run the analysator testpackage based on git diff and compare the images
name: Turso compare selectively images
on:
pull_request:
branches: [ master, dev]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
turso_system:
if: github.repository_owner == 'fmihpc'
runs-on: carrington
timeout-minutes: 120
strategy:
fail-fast: false
max-parallel: 2
matrix:
extras: ["testpackage"]
steps:
- uses: actions/checkout@v4
timeout-minutes: 5
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
timeout-minutes: 5
- name: Install dependencies
timeout-minutes: 5
run: |
export TMPDIR=$RUNNER_TEMP
export UV_LINK_MODE=copy
module purge
module load Python/3.10.4-GCCcore-11.3.0
uv venv CI_env
. CI_env/bin/activate
uv pip install --editable ../analysator[${{ matrix.extras }}]
- name: Produce plots
id: run_cl
run: |
export TMPDIR=$RUNNER_TEMP
module purge
module load Python/3.10.4-GCCcore-11.3.0
verf_loc="/turso/group/spacephysics/analysator/CI/verification_sets"
verfset=$(ls -lth $verf_loc | grep ^d | head -n1 | grep -Po '\w+$')
if [[ -f $verf_loc/$verfset/.lockfile ]]; then
echo -e ".lockfile found in $verf_loc/$verfset, not running test, as the verification set generation is likely still ongoing\n Check ongoing actions and/or re-run verification set generation."
exit 1
fi
export DIFFRESULT=$(python ./testpackage/testpackage_get_diff.py ${{ github.base_ref }})
if [[ -f diff_log.txt ]]; then
cat diff_log.txt
fi
echo "DIFFRESULT=$DIFFRESULT" >> $GITHUB_OUTPUT
MAX_ARRAY=14
TOTAL_TESTS=$(ls ./testpackage/testpackage_definitions/ | wc -l)
if [[ $DIFFRESULT && $DIFFRESULT != "pass" ]]; then
NUM_OF_TESTS=$(echo $DIFFRESULT | sed -e 's/ /\n/g' | wc -l)
ARRAY_SIZE=$(( NUM_OF_TESTS*((MAX_ARRAY+TOTAL_TESTS-1)/TOTAL_TESTS) )) #Rounding up
ARRAY_SIZE=$(( ARRAY_SIZE < MAX_ARRAY ? ARRAY_SIZE : MAX_ARRAY ))
else
ARRAY_SIZE=$MAX_ARRAY
fi
export ARRAY_SIZE=$ARRAY_SIZE
echo "ARRAY_SIZE=$ARRAY_SIZE" >> $GITHUB_OUTPUT
echo "Running $DIFFRESULT, ARRAY_SIZE $ARRAY_SIZE"
.github/workflows/make_sbatch_job.sh run_testpackage_workflow $DIFFRESULT
- name: Comparing plotted data
run: |
export TMPDIR=$RUNNER_TEMP
module load Python/3.10.4-GCCcore-11.3.0
. CI_env/bin/activate
export ARRAY_SIZE=${{ steps.run_cl.outputs.ARRAY_SIZE }}
echo "ARRAY_SIZE $ARRAY_SIZE"
.github/workflows/make_sbatch_job.sh run_compare ${{ steps.run_cl.outputs.DIFFRESULT }}
- name: scancel dangling job upon cancellation
if: cancelled()
run: |
scancel ${{ steps.run_cl.outputs.SLURM_JOB_ID }}