@@ -17,7 +17,7 @@ SLURM_LOG=/farm_out/%u/%x-%A_%a
1717# default options
1818dataset=test_v0
1919declare -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
2222done
2323outputDir=" "
@@ -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
0 commit comments