Skip to content

Commit

Permalink
improve test - don't rely on dice rolls
Browse files Browse the repository at this point in the history
  • Loading branch information
ric-evans committed Nov 21, 2024
1 parent c16cb54 commit 8003fb1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/wipac-cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ jobs:
- name: Create source dataset dirs/files
run: |
set -euo pipefail
precreate_ct=0
max_to_precreate=2
dataset_dpaths=(
/tmp/data/sim/{IceCube,Upgrade}/{2022,2023}/{generated,filtered}/{CORSIKA,neutrino-generator}/{77777,88888,99999}
)
Expand All @@ -236,17 +239,16 @@ jobs:
# pre-create some of these files in the destination
if [[ "${{ matrix.prev_histos_setting }}" == "overwrite" || "${{ matrix.prev_histos_setting }}" == "keep" ]]; then
echo "creating 'existing' histo file (75% chance)"
# check that this histo would be touched by the script (then only do it 75% of the time)
if [[ "$dpath" == "${{ matrix.src_path }}"* ]] && (( RANDOM % 100 < 75 )); then
# check that this histo would be touched by the script (and only make some of these)
if [[ "$dpath" == "${{ matrix.src_path }}"* ]] && (( precreate_ct < max_to_precreate )); then
echo "creating 'existing' histo file"
relative_path="${dpath#*/sim/}"
dest_dataset_dir="$DEST_DIR/sim/$relative_path"
mkdir -p "$dest_dataset_dir"
set -x
touch "$dest_dataset_dir"/"$(basename "$dest_dataset_dir").histo.hdf5"
set +x
else
echo "no file made :o)"
(( precreate_ct++ ))
fi
fi
Expand Down

0 comments on commit 8003fb1

Please sign in to comment.