Skip to content

Commit fc222d0

Browse files
committed
refactor!: don't make chefs pick a dataset name
be more consistent with workflow step: require only one output-type argument (`-p`)
1 parent 9d6b6e1 commit fc222d0

4 files changed

Lines changed: 112 additions & 71 deletions

File tree

bin/qtl-analysis

Lines changed: 78 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ set -e
44
set -u
55
source $(dirname $0)/../libexec/environ.sh
66

7+
##################################################################################
8+
79
# timeline webserver directory
810
WEBURL="https://clas12mon.jlab.org"
9-
WEBDIR=/u/group/clas/www/clas12mon/html/hipo
11+
WEBDIR=/group/clas/www/clas12mon/html/hipo
12+
13+
##################################################################################
1014

1115
# default options
1216
match="^"
1317
inputDir=""
1418
publishDir=""
1519
publishNote=""
16-
publishUrl=""
1720
metaSettings=""
1821
dataset=""
1922
outputDir=""
@@ -25,6 +28,8 @@ for key in list just-pub just-ana skip-mya debug overwrite custom-pub help; do
2528
modes[$key]=false
2629
done
2730

31+
##################################################################################
32+
2833
# usage
2934
sep="================================================================"
3035
usageTerse() {
@@ -36,21 +41,15 @@ usageTerse() {
3641
3742
CHEF OPTIONS: most of these are required for chef's production
3843
39-
-d [DATASET_NAME] required unique dataset name, defined by the user
40-
41-
-i [INPUT_DIR] input directory
42-
- chefs: use the output 'hist' directory, which
43-
contains subdirectories for each run
44-
- default = ./outfiles/[DATASET_NAME]
44+
-i [INPUT_DIR] input directory; use the output workflow
45+
directory, which has subdirectories for each run
4546
46-
-p [PUBLISH_DIR] publish timeline results to
47-
$WEBURL/[PUBLISH_DIR]/[DATASET_NAME]/tlsummary
48-
- chefs: usually your run group (e.g., 'rgb'), or a
49-
subdirectory within (e.g. 'rgb/pass0')
50-
- required (or see expert options with '--help')
47+
-p [PUBLISH_DIR] publish timeline results to URL
48+
$WEBURL/[PUBLISH_DIR]/tlsummary
49+
(i.e., $WEBDIR/[PUBLISH_DIR])
5150
52-
-n [NOTE] additional note that will be shown on the clas12mon webpage
53-
(i.e., the README file); surround your note in quotes
51+
-n [NOTE] additional note that will be shown on the clas12mon
52+
webpage; surround it in quotes
5453
- default: ''
5554
5655
-s [SETTINGS] apply run-group or dataset specific settings; one of:
@@ -59,13 +58,19 @@ $(find $TIMELINESRC/data/metadata -name "*.json" -exec basename {} .json \; | se
5958
""">&2
6059
}
6160
usageVerbose() {
62-
echo """ EXPERT OPTIONS: these are generally for developers, not chefs
61+
echo """ DEVELOPER OPTIONS: these are generally for developers, not chefs
62+
63+
-d [DATASET_NAME] unique dataset name, defined by the user
64+
- you may have used it in 'qtl histogram'
65+
- default: directory basename of [PUBLISH_DIR]
66+
67+
-i [INPUT_DIR] input directory
68+
- the default is such that users only ever have
69+
to use '-d [DATASET]' to refer to a local dataset
70+
- default: ./outfiles/[DATASET_NAME]
6371
6472
-o [OUTPUT_DIR] output directory for the analyzed timelines
6573
- default = ./outfiles/[DATASET_NAME]
66-
- chefs: if you use this default, it may be convenient
67-
to make a symbolic link named 'outfiles' to a
68-
directory on '/volatile'
6974
7075
-j [NUM_THREADS] number of parallel threads to run
7176
- default = $numThreads
@@ -98,7 +103,7 @@ usageVerbose() {
98103
}
99104
if [ $# -eq 0 ]; then
100105
usageTerse
101-
echo " For more (expert) options, run with '--help'" >&2
106+
echo " For more options, run with '--help'" >&2
102107
exit 101
103108
fi
104109

@@ -133,6 +138,29 @@ if ${modes['help']}; then
133138
exit 101
134139
fi
135140

141+
##################################################################################
142+
143+
# main executable for detector timelines
144+
run_analysis_script="org.jlab.clas.timeline.analysis.run_analysis"
145+
146+
# build list of timelines
147+
if ${modes['skip-mya']}; then
148+
timelineList=$(java $TIMELINE_JAVA_OPTS $run_analysis_script --timelines | grep -vE '^epics_' | sort | grep $match)
149+
else
150+
timelineList=$(java $TIMELINE_JAVA_OPTS $run_analysis_script --timelines | sort | grep $match)
151+
fi
152+
153+
# list detector timelines, if requested
154+
if ${modes['list']}; then
155+
echo $sep
156+
echo "LIST OF TIMELINES"
157+
echo $sep
158+
echo $timelineList | sed 's; ;\n;g'
159+
exit $?
160+
fi
161+
162+
##################################################################################
163+
136164
# set flow control booleans
137165
## handle `--just-ana` and `--just-pub`
138166
enableAna=false
@@ -158,37 +186,10 @@ if ${modes['debug']}; then
158186
enablePub=false
159187
fi
160188

161-
# get main executable for detector timelines
162-
run_analysis_script="org.jlab.clas.timeline.analysis.run_analysis"
163-
164-
# build list of timelines
165-
if ${modes['skip-mya']}; then
166-
timelineList=$(java $TIMELINE_JAVA_OPTS $run_analysis_script --timelines | grep -vE '^epics_' | sort | grep $match)
167-
else
168-
timelineList=$(java $TIMELINE_JAVA_OPTS $run_analysis_script --timelines | sort | grep $match)
169-
fi
170-
171-
# list detector timelines, if requested
172-
if ${modes['list']}; then
173-
echo $sep
174-
echo "LIST OF TIMELINES"
175-
echo $sep
176-
echo $timelineList | sed 's; ;\n;g'
177-
exit $?
178-
fi
179-
180-
# set input and output directories
181-
[ -z "$dataset" ] && printError "data set not specified, use option '-d'" && exit 100
182-
[ -z "$inputDir" ] && inputDir=$(pwd -P)/outfiles/$dataset/timeline_detectors
183-
[ ! -d $inputDir ] && printError "input directory $inputDir does not exist" && exit 100
184-
[ -z "$outputDir" ] && outputDir=$(realpath $(pwd -P)/outfiles/$dataset) || outputDir=$(realpath $outputDir)
185-
186-
# set subdirectories
187-
finalDirPreQA=$outputDir/timeline_web_preQA
188-
finalDir=$outputDir/timeline_web
189-
logDir=$outputDir/log
189+
##################################################################################
190190

191191
# check publishing options
192+
publishUrl=""
192193
if $enablePub; then
193194
# check publishDir arg
194195
if [ -z "$publishDir" ]; then
@@ -198,9 +199,9 @@ if $enablePub; then
198199
fi
199200
# set full path to publish dir (unless --custom-pub)
200201
if ! ${modes['custom-pub']}; then
201-
publishUrl=$WEBURL/$publishDir/$dataset/tlsummary
202+
publishUrl=$WEBURL/$publishDir/tlsummary
202203
[ "$publishDir" = "." ] && printError "publishing directory argument cannot be '.'" && exit 100
203-
publishDir=$WEBDIR/$publishDir/$dataset
204+
publishDir=$WEBDIR/$publishDir
204205
else
205206
publishUrl="option '--custom-pub' was used, therefore timeline URL is UNKNOWN"
206207
fi
@@ -236,6 +237,27 @@ if $enablePub; then
236237
publishNote="${timestamp}${publishNote}; timeline-code v$version"
237238
fi
238239

240+
# set the dataset name, if not already set
241+
if [ -z "$dataset" ]; then
242+
if [ -n "$publishDir" ]; then
243+
dataset=$(basename $publishDir)
244+
echo "setting dataset name from the publishing directory to '$dataset'"
245+
else
246+
printError "neither dataset name (-d) nor publishing directory (-p) are set; need at least one..."
247+
exit 100
248+
fi
249+
fi
250+
251+
# set input and output directories
252+
[ -z "$inputDir" ] && inputDir=$(pwd -P)/outfiles/$dataset/timeline_detectors
253+
[ ! -d $inputDir ] && printError "input directory $inputDir does not exist" && exit 100
254+
[ -z "$outputDir" ] && outputDir=$(realpath $(pwd -P)/outfiles/$dataset) || outputDir=$(realpath $outputDir)
255+
256+
# set subdirectories
257+
finalDirPreQA=$outputDir/timeline_web_preQA
258+
finalDir=$outputDir/timeline_web
259+
logDir=$outputDir/log
260+
239261
# print settings
240262
echo """
241263
Settings:
@@ -291,6 +313,11 @@ fi
291313
mkdir -p $logDir $finalDirPreQA $finalDir
292314

293315

316+
##################################################################################
317+
##################################################################################
318+
##################################################################################
319+
320+
294321
######################################
295322
# produce detector timelines
296323
######################################

bin/qtl-physics

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ customPubArg=''
164164
if ${modes['custom-pub']}; then
165165
customPubArg=--custom-pub
166166
fi
167-
$TIMELINESRC/qtl analysis \
167+
$TIMELINESRC/bin/qtl analysis \
168168
-d $dataset \
169169
-i $inputDir \
170170
-o $outputDir \

doc/chef_guide.md

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,53 @@ The timeline code is provided on `ifarm` via
44
```bash
55
module load timeline
66
```
7+
The main script for running timelines is `qtl`:
8+
```bash
9+
qtl --help
10+
qtl --version
11+
```
712

813
Please report any issues to the software maintainers, such as warnings or error messages.
914

10-
## :green_circle: Step 1: The workflow
15+
## General Timelines
1116

12-
Use the `qtl` model as part of your usual cooking workflow;
13-
see [the Chefs' documentation wiki](https://clasweb.jlab.org/wiki/index.php/CLAS12_Chef_Documentation).
17+
### :green_circle: Step 1: Fill Timeline Histograms
1418

15-
Output files will appear in your chosen output directory, within `hist/detectors/`.
19+
Use the "qtl" model as part of your usual cooking workflow; see [the Chefs' documentation wiki](https://clasweb.jlab.org/wiki/index.php/CLAS12_Chef_Documentation).
1620

17-
> [!NOTE]
18-
> If you want physics timelines, for now you'll need to use `qtl histogram --focus-physics`; we will eventually include this in the workflow!
21+
Output files will appear in your chosen output directory, within `hist/detectors/`.
1922

20-
## :green_circle: Step 2: Make the timelines
23+
### :green_circle: Step 2: Analyze Histograms and Make the Timelines
2124

25+
Print the usage guide:
26+
```bash
27+
qtl analysis
28+
```
29+
In general,
2230
```bash
23-
qtl analysis -d $dataset -i $out_dir/hist/detectors -p $publish_dir
31+
qtl analysis -i $out_dir/hist/detectors -p $publish_dir
2432
```
25-
- `$dataset` is a unique name for this cook, _e.g._, `rga_v1.23`
33+
where
2634
- `$out_dir` is your output directory from **Step 1**
27-
- `$publish_dir` is the publishing directory
28-
- example: `rgb/pass0`
29-
- note: the full publishing path will be `/group/clas/www/clas12mon/html/hipo/${publish_dir}/${dataset}`
35+
- `$publish_dir` is the publishing directory to [`clas12mon`](https://clas12mon.jlab.org/)
36+
- the full publishing path will be `/group/clas/www/clas12mon/html/hipo/${publish_dir}`
37+
- the URL will be `https://clas12mon.jlab.org/${publish_dir}/tlsummary
3038

31-
A URL will be printed upon success, and a link will appear in [`clas12mon`](https://clas12mon.jlab.org/) in your run group's area momentarily.
39+
Additional options may be _needed_ for your specific dataset, so check the usage guide (run `qtl analysis`).
3240

33-
> [!IMPORTANT]
34-
> Run `qtl analysis` with no further arguments for additional usage; some options may be _needed_ for your run group!
41+
A URL will be printed upon success, and a link will appear in [`clas12mon`](https://clas12mon.jlab.org/) in your run group's area momentarily.
3542

3643
> [!TIP]
37-
> Step 2 generates analyzed timeline files and logging information to a separate directory.
38-
> - You can control that directory with the `-o` option, or just use the default.
39-
> - If using the default, consider making a symbolic link named `outfiles` pointing to somewhere on `/volatile`, since once timelines are published successfully, you don't really need these output files
44+
> `qtl analysis` produces temporary files, by default in a subdirectory of `./outfiles/`. Consider making a symbolic link named `outfiles` pointing to somewhere on `/volatile`.
45+
46+
## Physics QA timelines
47+
48+
The physics timelines will eventually be combined with the detector timelines; until then, they are run separately:
49+
50+
- **Step 1:** Either:
51+
- Use `qtl histogram` instead of the workflow, with the option `--focus-physics`; this will run on SLURM directly (rather than through SWIF)
52+
- Use the `--physics` option with the workflow "qtl" model
53+
- **Step 2:** Run `qtl physics` instead of `qtl analysis`; its options are similar
4054

4155
---
4256

util/dump-timelines.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if(args.length>1) outFilePrefix = args[1]
1414
def inSpec = args[0]
1515
def inFiles = []
1616
if(inSpec ==~ /^https.*clas12mon.jlab.org.*timeline.*/) {
17-
def inDir = inSpec.replaceAll(/^.*jlab.org/, "/u/group/clas/www/clas12mon/html/hipo")
17+
def inDir = inSpec.replaceAll(/^.*jlab.org/, "/group/clas/www/clas12mon/html/hipo")
1818
inDir = "/"+inDir.tokenize('/')[0..-2].join("/")
1919
def inDirObj = new File(inDir)
2020
inDirObj.traverse(type: groovy.io.FileType.FILES, nameFilter: ~/.*\.hipo/) {

0 commit comments

Comments
 (0)