Skip to content

Commit f60174c

Browse files
authored
feat(qadb): check physics timelines for RG-K and RG-E ongoing pass-1 cooks (#469)
1 parent 8bf795d commit f60174c

3 files changed

Lines changed: 130 additions & 6 deletions

File tree

bin/qtl-histogram

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SLURM_LOG=/farm_out/%u/%x-%A_%a
1717
# default options
1818
dataset=test_v0
1919
declare -A modes
20-
for key in findhipo rundir eachdir flatdir single series submit check-cache swifjob focus-detectors focus-physics help; do
20+
for key in findhipo rundir eachdir flatdir single series submit check-cache fast-ls swifjob focus-detectors focus-physics help; do
2121
modes[$key]=false
2222
done
2323
outputDir=""
@@ -81,8 +81,9 @@ usageVerbose() {
8181
directory tree, e.g., runs grouped by target
8282
8383
--rundir assume each specified [RUN_DIRECTORY] contains
84-
subdirectories named as just run numbers; it is not
85-
recommended to use wildcards for this option
84+
subdirectories named as just run numbers;
85+
- it is not recommended to use wildcards for this option
86+
- see also the \`--fast-ls\` option
8687
**this is the DEFAULT option**
8788
8889
--eachdir assume each specified [RUN_DIRECTORY] is a single
@@ -121,6 +122,15 @@ usageVerbose() {
121122
122123
--focus-physics run histogramming for physics QA timelines
123124
125+
*** MISCELLANEOUS OPTIONS
126+
127+
--fast-ls use \`jasmine list-files\` to get lists of files, rather
128+
than commands such as \`find\` or \`ls\`, since \`jasmine\`
129+
may be much faster than the latter commands for tape dirs.
130+
- WARNING: assumes you already tested \`--check-cache\`,
131+
since \`jasmine\` uses \`/mss\` stub files
132+
- useful for options such as \`--rundir\` for DST files
133+
124134
$sep
125135
126136
EXAMPLES:
@@ -300,7 +310,7 @@ declare -A runnumHash # `rdirs` element -> run number
300310
for rdir in ${rdirs[@]}; do
301311
# get the run number, either from `rdir` basename (fast), or from `RUN::config` (slow)
302312
[[ ! -e $rdir ]] && printError "the run file/directory '$rdir' does not exist" && continue
303-
runnum=$(basename $rdir | grep -m1 -o -E "[0-9]+" || echo '') # first, try from run directory (or file) basename
313+
runnum=$(basename $rdir | grep -m1 -o -E "[0-9]+" | tail -n1 || echo '') # first, try from run directory (or file) basename
304314
if [ -z "$runnum" ] || ${modes['swifjob']}; then # otherwise, use RUN::config from a HIPO file (NOTE: assumes all HIPO files have the same run number)
305315
if ${modes['flatdir']}; then
306316
$TIMELINESRC/libexec/hipo-check.sh $rdir
@@ -313,7 +323,8 @@ for rdir in ${rdirs[@]}; do
313323
runnum=$($TIMELINESRC/libexec/run-groovy-timeline.sh $TIMELINESRC/libexec/get-run-number.groovy $firstHipo | tail -n1 | grep -m1 -o -E "[0-9]+" || echo '')
314324
fi
315325
fi
316-
[ -z "$runnum" -o $runnum -eq 0 ] && printError "unknown run number for '$rdir'; ignoring it!" && continue
326+
[ -z "$runnum" ] && printError "unknown run number for '$rdir'; ignoring it!" && continue
327+
[ $runnum -eq 0 ] && printError "unknown run number for '$rdir'; ignoring it!" && continue
317328
runnum=$((10#$runnum))
318329
runnumHash[$rdir]=$runnum
319330
done
@@ -366,7 +377,18 @@ for rdir in ${rdirs[@]}; do
366377
realpath $rdir > $inputListFile
367378
else
368379
[[ "$(realpath $rdir)" =~ /mss/ ]] && swifPrefix="mss:" || swifPrefix="file:"
369-
realpath $rdir/*.hipo | sed "s;^;$swifPrefix;" > $inputListFile
380+
if ${modes['fast-ls']}; then
381+
rdir_mss=$(realpath $rdir | sed 's;^.*/cache/;/mss/;')
382+
rdir_cache=$(realpath $rdir)
383+
# fast-ls mode will use `jasmine list-files`, but requires the stub files on `mss` to exist; if a cook is ongoing,
384+
# it's possible the `/mss` directory won't be populated yet, although files are already on `/cache`; for that case,
385+
# fall back to "slow" ls (i.e., the command that runs when not using `--fast-ls`)
386+
jasmine list-files -display json -under $rdir_mss | jq -r '.[].mss' | xargs -n1 basename | sed "s;^;${swifPrefix}${rdir_cache}/;" > $inputListFile \
387+
|| { printWarning "falling back to slow ls..."; realpath $rdir/*.hipo | sed "s;^;$swifPrefix;" > $inputListFile; }
388+
else
389+
echo " (use \`--fast-ls\` if this seems too slow)"
390+
realpath $rdir/*.hipo | sed "s;^;$swifPrefix;" > $inputListFile
391+
fi
370392
fi
371393

372394
# generate job scripts

qadb/notes/rge_sp24.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Run Group E, Spring 2024, Pass 1
2+
3+
There is no SIDIS-like train, so let's use DST files for the QA.
4+
5+
Similarly to RG-C, there are several targets that we'll need to combine; let's also combine torus polarities.
6+
7+
The DSTs are found in:
8+
```
9+
/cache/clas12/rg-e/production/spring2024/pass1/*/*/dst/recon
10+
```
11+
12+
## Reheat
13+
14+
**TODO**:
15+
- [ ] check if needed; see Fall 2018 RG-K notes
16+
- [ ] if reheating is needed, fix `qtl histogram` paths below
17+
18+
## Run monitoring
19+
20+
> [!IMPORTANT]
21+
> Check any run-dependent settings in `qa-physics/monitorRead.groovy`, such as beam energy.
22+
23+
> [!NOTE]
24+
> Using `--rundir` and `--fast-ls` here rather than `--flatdir`, since we're using a directory of DST files.
25+
26+
check cache:
27+
```bash
28+
bin/qtl histogram -d rge_sp24 --check-cache --rundir --fast-ls --focus-physics $(ls -d /cache/clas12/rg-e/production/spring2024/pass1/*/*/dst/recon)
29+
```
30+
31+
run:
32+
```bash
33+
bin/qtl histogram -d rge_sp24 --rundir --fast-ls --focus-physics $(ls -d /cache/clas12/rg-e/production/spring2024/pass1/*/*/dst/recon)
34+
```
35+
36+
## Double check that we have all the runs
37+
38+
> [!IMPORTANT]
39+
> In case any runs disappeared from `/cache` while running monitoring or reheating, be sure to cross check the output runs with those from `/mss`
40+
41+
## Make timelines
42+
43+
**TODO**:
44+
- [ ] populate `/data/metadata` for RG-E's target types
45+
46+
Make the timelines:
47+
```bash
48+
bin/qtl physics -d rge_sp24 -p rge/qa_pass1_sp24
49+
```
50+
51+
> [!WARNING]
52+
> You may not have permission to publish to this directory; if not, publish to another place and ask the chef to copy the files

qadb/notes/rgk_sp24.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Run Group K, Spring 2024, Pass 1
2+
3+
We will use SIDIS skims from two datasets: one for a 6.4 GeV beam, and another for a 8.5 GeV beam; we will keep them separate, to be consistent with what we did for Fall 2018 RG-K data:
4+
- `rgk_sp24_6.4GeV`: from `/cache/clas12/rg-k/production/recon/spring2024/pass1/6395MeV/dst/train/skim1`
5+
- `rgk_sp24_8.5GeV`: from `/cache/clas12/rg-k/production/recon/spring2024/pass1/8477MeV/dst/train/skim1`
6+
7+
Before anything, cross check the train and DST run lists:
8+
```bash
9+
bin/qtl xtrain /mss/clas12/rg-k/production/recon/spring2024/pass1/6395MeV/dst/train/skim1 /mss/clas12/rg-k/production/recon/spring2024/pass1/6395MeV/dst/recon
10+
bin/qtl xtrain /mss/clas12/rg-k/production/recon/spring2024/pass1/8477MeV/dst/train/skim1 /mss/clas12/rg-k/production/recon/spring2024/pass1/8477MeV/dst/recon
11+
```
12+
13+
## Reheat
14+
15+
**TODO**:
16+
- [ ] check if needed; see Fall 2018 RG-K notes
17+
- [ ] if reheating is needed, fix `qtl histogram` paths below
18+
19+
## Run monitoring
20+
21+
> [!IMPORTANT]
22+
> Check any run-dependent settings in `qa-physics/monitorRead.groovy`, such as beam energy.
23+
24+
check cache:
25+
```bash
26+
bin/qtl histogram -d rgk_sp24_6.4GeV --check-cache --flatdir --focus-physics /cache/clas12/rg-k/production/recon/spring2024/pass1/6395MeV/dst/train/skim1
27+
bin/qtl histogram -d rgk_sp24_8.5GeV --check-cache --flatdir --focus-physics /cache/clas12/rg-k/production/recon/spring2024/pass1/8477MeV/dst/train/skim1
28+
```
29+
30+
run:
31+
```bash
32+
bin/qtl histogram -d rgk_sp24_6.4GeV --flatdir --focus-physics /cache/clas12/rg-k/production/recon/spring2024/pass1/6395MeV/dst/train/skim1
33+
bin/qtl histogram -d rgk_sp24_8.5GeV --flatdir --focus-physics /cache/clas12/rg-k/production/recon/spring2024/pass1/8477MeV/dst/train/skim1
34+
```
35+
36+
## Double check that we have all the runs
37+
38+
> [!IMPORTANT]
39+
> In case any runs disappeared from `/cache` while running monitoring or reheating, be sure to cross check the output runs with those from `/mss`
40+
41+
## Make timelines
42+
43+
Make the timelines, separately for each of the 2 datasets:
44+
```bash
45+
bin/qtl physics -d rgk_sp24_6.4GeV -p rgk/pass2/qa/sp24_6.4GeV
46+
bin/qtl physics -d rgk_sp24_8.5GeV -p rgk/pass2/qa/sp24_8.5GeV
47+
```
48+
49+
> [!WARNING]
50+
> You may not have permission to publish to this directory; if not, publish to another place and ask the chef to copy the files

0 commit comments

Comments
 (0)