Skip to content

Commit a151bce

Browse files
committed
feat: --fast-ls
1 parent 3a9a005 commit a151bce

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

bin/qtl-histogram

Lines changed: 23 additions & 4 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 \`--fast-ls\` option
8687
**this is the DEFAULT option**
8788
8889
--eachdir assume each specified [RUN_DIRECTORY] is a single
@@ -121,6 +122,13 @@ 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\`
129+
- useful for options such as \`--rundir\` for DST files
130+
- WARNING: assumes you already tested \`--check-cache\`
131+
124132
$sep
125133
126134
EXAMPLES:
@@ -367,7 +375,18 @@ for rdir in ${rdirs[@]}; do
367375
realpath $rdir > $inputListFile
368376
else
369377
[[ "$(realpath $rdir)" =~ /mss/ ]] && swifPrefix="mss:" || swifPrefix="file:"
370-
realpath $rdir/*.hipo | sed "s;^;$swifPrefix;" > $inputListFile
378+
if ${modes['fast-ls']}; then
379+
rdir_mss=$(realpath $rdir | sed 's;^.*/cache/;/mss/;')
380+
rdir_cache=$(realpath $rdir)
381+
# fast-ls mode will use `jasmine list-files`, but requires the stub files on `mss` to exist; if a cook is ongoing,
382+
# it's possible the `/mss` directory won't be populated yet, although files are already on `/cache`; for that case,
383+
# fall back to "slow" ls (i.e., the command that runs when not using `--fast-ls`)
384+
jasmine list-files -display json -under $rdir_mss | jq -r '.[].mss' | xargs -n1 basename | sed "s;^;${swifPrefix}${rdir_cache}/;" > $inputListFile \
385+
|| { printWarning "falling back to slow ls..."; realpath $rdir/*.hipo | sed "s;^;$swifPrefix;" > $inputListFile; }
386+
else
387+
echo " (use \`--fast-ls\` if this seems too slow)"
388+
realpath $rdir/*.hipo | sed "s;^;$swifPrefix;" > $inputListFile
389+
fi
371390
fi
372391

373392
# generate job scripts

qadb/notes/rge_sp24.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ The DSTs are found in:
2121
> Check any run-dependent settings in `qa-physics/monitorRead.groovy`, such as beam energy.
2222
2323
> [!NOTE]
24-
> Using `--rundir` here rather than `--flatdir`, since we're using a directory of DST files.
24+
> Using `--rundir` and `--fast-ls` here rather than `--flatdir`, since we're using a directory of DST files.
2525
2626
check cache:
2727
```bash
28-
bin/qtl histogram -d rge_sp24 --check-cache --rundir --focus-physics $(ls -d /cache/clas12/rg-e/production/spring2024/pass1/*/*/dst/recon)
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)
2929
```
3030

3131
run:
3232
```bash
33-
bin/qtl histogram -d rge_sp24 --rundir --focus-physics $(ls -d /cache/clas12/rg-e/production/spring2024/pass1/*/*/dst/recon)
33+
bin/qtl histogram -d rge_sp24 --rundir --fast-ls --focus-physics $(ls -d /cache/clas12/rg-e/production/spring2024/pass1/*/*/dst/recon)
3434
```
3535

3636
## Double check that we have all the runs

0 commit comments

Comments
 (0)